VirtueMart 1.1.x [ Old version - no longer supported ] > Products, Prices, Tax and Categories VM 1.1
Problem with Attributes not showing discounted prices.
theredrobot:
Is there another way round this - to stop the discount applied to a product in 'product info' tab, also being applied to the attribute price, when it is added to the cart?
Thereby the price inserted for the 'Product Attribute' is the price displayed on the front end, and also the price inserted into the cart. The discount has no effect.
Would it mean editing one of the 'addtocart_form.tpl.php' pages?
If someone can direct me to appropriate page/code where discount is applied to the attribute price, I'll have a go and try and find a solution.
PRO:
yes there is, if you can code it
The code would go here
ps_product.attribute.php
its just a matter of looking up "discount_info" and using math to calculate it.
I am not a coder, and thats all I can tell you
theredrobot:
OK some success - if I change line 762 of ps_product_attribute.php (in classes)
$price = floatval( substr( $base_value, strrpos( $base_value, '[' ) + 2 ) );
to
$price = floatval( substr( $base_value, strrpos( $base_value, '[' ) + 2 ) ) * 0.5 ;
It has the effect of cancelling out the discount set at 50%.
So the price inserted for the 'Product Attribute' is the price displayed on the front end, and also the price inserted into the cart.
But cant seem to get it to work when replacing the '0.5' with $discount_info['amount'] - it's returning a zero to the sum.
So I need help with what code I need to call the discount percentage from the database for a particular product. Any Suggestions please.
PRO:
actually its discount amount. Here is the table data.
jos_vm_product_discount
jos_vm_product_discount`.`amount`
theredrobot:
--- Quote from: BanquetTables.pro on March 14, 2011, 06:28:11 AM ---actually its discount amount. Here is the table data.
jos_vm_product_discount
jos_vm_product_discount`.`amount`
--- End quote ---
Thanks - I was aware the 'number' I need to pull in from the database is the 'amount' in jos_vm_product_discount. I just can't code it!
I have tried:
$price = floatval( substr( $base_value, strrpos( $base_value, '[' ) + 2 ) ) * $discount_info['amount']/100 ;
$price = floatval( substr( $base_value, strrpos( $base_value, '[' ) + 2 ) ) * $discount_id['amount']/100;
$price = floatval( substr( $base_value, strrpos( $base_value, '[' ) + 2 ) ) * $discount['amount']/100 ;
Without success.
There are a number of instances of $discount_info['amount'] throughout Virtuemart, so I though it would work.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version