Elxis CMS Forum
Extensions => Components => Topic started by: sophocles on January 17, 2013, 09:38:24
-
Hi,
At SHOW ORDERED PRODUCTS part of code, at line 337 there is a block of code that displays the title of the ordered product (on the invoice generated).
echo '<td><span style="font-weight: bold;">'.$row['title'].'</span>'
.
Below this line there are seven lines of code that display the variant of a product as well as its price.
I need to display also the price of the product (minus the discount) without that variant, since at line 353 the code outputs the total amount (the products initial price plus the price of the variant minus the discount of the product).
I tried these lines of code (among many many others...), but nothing is being subtracted from the price of the product and still displays the .
echo '<span style="font-weight: bold;">'.$row['title'].$eshop->longprice($unitprice - $row['variants']).'</span>';
echo '<span style="font-size: small;">'.$row['title'].($row['amount']-$row['variants']).'</span>';
echo '<span style="font-weight: bold;">'.$row['title'].$eshop->longprice($unitprice - $modifier).'</span>';
Where am I mistaken? I have searched through all relevant files, but I didn't find any type of variable to display the desired value.
Thanks in advance.
-
Each ordered product's unit price is $unitprice = $row['amount']/$row['quantity'];
The $row['amount'] contains the the price with the discounts applied to the product for this specific customer. To find out the initial price (without discounts and taxes) you have to query the database on table elx_eshop_prices. But be careful as the prices depends on user groups. So for the same product you might find multiple prices there, if you are not sure select the general users group price (id = 1).
SELECT price, discount, tax FROM #__eshop_prices WHERE id = xx AND sgid = 1;
I don't find the idea of showing the initial price correct as it might be smaller than the the price that specific customer paid for... You will only confuse the user. Also the price might have changed since the customer bought the product, and there is the danger of showing him wrong price! The correct unit price to display is $unitprice which is the exact price the customer paid at the moment he purchased the product.
-
Hi,
As you can see from the image, someone has ordered a product as well as an accessory.
The price being shown in the first line ( (i), 70,12 € ) is the same shown in the ( "Total" (iii) 70,12 ) at the far right.
This price ( (i), 70,12 € ) though contains the value of the accessory( (ii), 6,12€).
The accounting department needs the first price ( (i), 70,12€) to be (70,12 - 6,12 = 64 €), instead of 70,12€, since when they issue the final receipt/invoice they need to know the price of each individual product.
Both prices ( 64 € and 6,12 € ) are the final prices, since they have a discount on their original price inside the eShop prices parameters tab (104€ and 7,53€ respectively).
(http://www.odesus.gr/images/temp/E-17.jpg)
-
No, it is not like that.
Price modifiers modify the price of the product. Variants are not separate products but features of the product, for example Red shirt, Blue Shirt etc. They cannot exist or sold without the main product (you can not sell a "shirt" and a "blue"). Note also that a product variant can have a negative value! The unit price of the product displays the price the customer actually got charged for this product based on his choices (Blue/Red shirt) and any discount occurred. The price of any product variants listed below have already been included into the unit price and they are shown only for informational reasons. Also by the time you see the invoice the prices of the products and the variants or the discounts may have changed. So, it is not safe to get these values from the products/variants db tables. This is why IOS Eshop saves the prices the customer got charged during his purchase as a unit price including the variants.
Conclusion: The price shown in the product variant line informs you how much the unit price was affected by that variant. It can be a positive, or negative amount, or it might not affect the product price. The product's unit price includes the sum of all product variants the customer picked. Variants are not separate products to list them and display VAT, etc, for them (as I said they can even have negative values).
If you want to make it more clear to your customers and avoid any confusion (although I think it is clear enough) you can hide the price of the variants by a small modification in the invoice class. But in this case you will lose the information about how much that variant affected the unit price. Contact me if you want me to do this change for you.
-
Ooops...
OK, got it. I will have to remove the variants that are really products.
Thanks