PDA

View Full Version : Sale Price Not working Category/Product Display


Dar-us-Salam.com
05-22-06, 02:52 PM
I have been trying fruitlessly for many hours to add Sale Price code to my store but am having several problems. I would appreciate it if someone could help me.

First I tried to use the Cost field by showing the Regular price and then the sale price. This worked fine on the Product Display but for some reason it doesn't work on category field. I think that the Cost field is not available to the Category page (I have not tried the search page yet). I couldn't find a way to make this available either.

Here is the code that worked on Product page but not category:
<!-- Sale Price Calculation via Cost Field -->
<mvt:if expr="l.settings:product:formatted_cost GT l.settings:product:formatted_price">
Reg. Price: <b><s>&mvt:product:formatted_cost;</s></b><br>
<font color="#FF0000">Sale Price: <b>&mvt:product:formatted_price;</b></font><br>
<mvt:else>
Price: <b>&mvt:product:formatted_price;</b><br>
</mvt:if>

Full Price Custom Field

After failing to do that I tried to go according to the Miva tutorial "Tips & Tricks: Displaying Price Markdowns." This has just an opposite effect: It works on Category page but not on the Product Display Page. I have tried many things but can't get it to display.


<!-- Calculates Sale Price -->
<mvt:if expr="NOT ISNULL l.settings:product:customfield_values:customfields :Full_Price">
Price:<s>&mvt:product:customfield_values:customfields:Full_P rice;</s><br>
<font color="#FF0000">On Sale: <b>&mvt:product:formatted_price;</b></font><br>
<mvt:else>
Price: <b>&mvt:product:formatted_price;</b><br>
</mvt:if>
Full Price: <b>&mvt:product:customfield_values:customfields:Full_P rice;</b><br>


The sample products I am using to test the Sale field are 007 & 008 found in this category:
http://store.dar-us-salam.com/store/main.mvc?Screen=CTGY&Store_Code=DP&Category_Code=Eng_Aqidah

I would appreciate it how I can get this to work. Is it possible that there is a bug in miva that I making this so difficult?

Thanks

Bruce - PhosphorMedia
05-22-06, 08:12 PM
As for your first code, you can't compare a "formatted" value (i.e., $1.99) with a math operating (GT)...you need to use l.settings:product:price and l.settings:product:cost

As for the category issue, make sure you are adding the code to the product list item...and make sure you are not placing it in an area that is wrapped in another conditional that evaluating false (for example Quantity in Basket display.

Dar-us-Salam.com
05-22-06, 10:33 PM
Thanks for the quick reply Bruce.

I was able to get the first code to work in the category display by removing the _formatted_ part. The calculation works ok and it displays the value but it doesn't display the formatted cost as it displays the formatted price. I have to manually add the $ sign and .00 at the end. This is My new code that works:

<!-- Sale Price Calculation via Cost Field -->
<mvt:if expr="l.settings:product:cost GT l.settings:product:price">
Reg. Price: <b><s>$ &mvt:product:cost; .00</s></b><br>
<font color="#FF0000">Sale Price: <b>&mvt:product:formatted_price;</b></font><br>
<mvt:else>
Price: <b>&mvt:product:formatted_price;</b><br>
</mvt:if>
This will work ok until the price is a whole #. I would then have to then make an if then statement to see if there are cents and then format it accordingly. There a better way to do this or a work around?


I didn't understand the second reply. I am copying the exact code that worked on the CTGY - Category Display to the PROD - Product Display and it won't see the custom variable Full_Price even without the conditional statement.

Bruce - PhosphorMedia
05-23-06, 12:06 AM
The reason it doesn't work is that there appears to be a bug in the category page rendering...it is not creating a varibale for l.settings:products:formatted_cost.