View Single Post
  #1  
Old 01-14-2011, 03:01 AM
 
adam.fearn adam.fearn is offline
 

Newbie
  
Join Date: Jan 2011
Posts: 8
 

Talking How to display the lowest Wholesale price on the list of products (4.4.2)

The question of how to make the lowest Wholesale Price appear in place of the standard price on a list of products, or questions that are very similar are ones that I've personally seen quite a lot of recently, most of which don't have a substantial answer to them - I myself have been trying to do this for the past few days too and have been searching the forums for an answer.

I've finally managed to get it working with 4.4.2 and I'm going to share it with you now in case you need to do something like this.

You'll be editing 4 files:
products.php (in cart root directory)
search.php
(in cart root directory)
featured_products.php (in cart root directory)
and
skin/common_files/customer/main
/products_list.tpl

In products.php, insert this code:
PHP Code:
foreach ($products as $key => $product_info){
    
$productid $product_info['productid'];


// I realise that many of you PHP pros will be able to code the following piece better, but this is basic and works.
    
$WSQuery    =   "SELECT * FROM xcart_pricing WHERE productid = $productid ORDER BY price ASC";
        
$WSResult   =   mysql_query($WSQuery) or die (mysql_error());
            
$WSRow  =   mysql_fetch_assoc($WSResult);
                
$WSPrice    =   $WSRow['price'];                            
                
$smarty->assign('WSPrice' $WSPrice);
                
$products[$key]['custom_min_price'] = $WSPrice;
 


Paste this same code into search.php and featured_products.php, but in certain places.

In products.php, put it right under this:

PHP Code:
$mode 'search';

include 
$xcart_dir '/include/search.php'

In search.php, put it right under this:

PHP Code:
$search_prefilled['need_advanced_options'] = true;

        }

    }




And in featured_products.php, put it right under this:

PHP Code:
include $xcart_dir '/include/search.php';

$search_data['products'] = $old_search_data

Now, in skin/common_files/customer/main/products_list.tpl, all you need to do is replace this code:

PHP Code:
<span class="price">{$lng.lbl_our_price}:</span> <span class="price-value">{currency value=$product.taxed_price}</span>
<
span class="market-price">{alter_currency value=$product.taxed_price}</span

with this:

PHP Code:
<span class="price">From:</span> <span class="price-value">ё{if $product.custom_min_price}{$product.custom_min_price}{else}$product.taxed_price{/if} </span>
<
span class="market-price">{alter_currency  value=$product.custom_min_price}</span

And there you have it, it should work just fine.

I hope this works for, or at least helps anyone who may be needing something like this.
Any questions, feel free to ask.

Kind Regards,

- Adam.
__________________
X-Cart Gold, version 4.4.2.
Reply With Quote