Thread: Newest Products
View Single Post
  #315  
Old 03-12-2012, 08:34 AM
 
MSfan MSfan is offline
 

Advanced Member
  
Join Date: Nov 2011
Posts: 56
 

Default Re: Newest Products

Quote:
Originally Posted by jriggins911
Sidebar from the latest discussion.....

So I have this mod installed and is working fine with one exception.

If I have a product with market price (not the price we are actually selling it for) the market price and the discount (our price vs market price) is not displayed.

For example if on the home page I have a featured product we are selling for $10 dollars with a market price of $20 dollars the selling price of $10, the market price of $20 and a discount of 50% is displayed. However, if the same product is displayed using this mod on the new products page only the $10 price is displayed.

The newest product mod calls all the same templates the featured products and all other category pages call (products.tpl or products_t.tpl) but the output is not the same.

After having parsed through all of the nested template calls I have narrowed it down to a conditional evaluation in products_t.tpl.



The problem here is the returns the appropriate value while returns nothing (as in not even zero). It seems as if the value isn't being passed or made available globally in this "function call".

Since the has no value the entire conditional IF evaluates to false and the market price and discount are not caluculated or displayed.

Since this mod initates the page display from the same template path, customer/home.tpl, and some of the variables are available from the product object ... why does the particular ".list_price" variable (list / market price) not return its' value?

Any ideas? Anyone else have this problem?

Though the post above is over three years old, I encountered this same issue and didn't notice a solution (granted I didn't check all the posts in this thread). Anyway, if anyone still wants to show the market price in addition to the sale price I think I figured out a way.

1. In the file include/func/func.product.php

Look for the following
Code:
$fields[] = $sql_tbl['products'] . ".productcode"; $fields[] = $sql_tbl['products'] . ".avail";

and add the following after it:
Code:
$fields[] = "$sql_tbl[products].list_price";

2. You will want to open your template file (I'm using the name products_tn.tpl) and write an if statement that compares the list_price to the taxed_price.

Your template code may differ depending on whose recommendation you are trying but look for something like this:
Code:
<tr{interline name=products_matrix} align="center"> {*Display price/market_price/taxes*} {foreach from=$row item=product name=products} {if $product} <td{interline name=products additional_class="product-cell product-cell-price"} align="center"> <div class="price-row" align="center"> <center> <span class="price">{$lng.lbl_our_price}:</span> <span class="price-value">{currency value=$product.taxed_price}</span> <center> <span class="market-price">{alter_currency value=$product.taxed_price}</span> </div>

And add something like this right after it:
Code:
{if $product.list_price gt $product.taxed_price} <div class="market-price"> <span class="market-price-value">Price: {currency value=$product.list_price}</span> {/if}

While I am a programmer, I don't know php at all, so I've stumbled through this. It seems to be working though I haven't throughly tested it. I've modified my X-Cart code a bunch so I don't know how helpful this will be (e.g. your class names/format may be different), but I hope it helps someone.
__________________
v4.4.4 Pro
Reply With Quote