X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How to display the lowest Wholesale price on the list of products (4.4.2) (https://forum.x-cart.com/showthread.php?t=57524)

adam.fearn 01-14-2011 03:01 AM

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.

Hamco 03-01-2011 07:50 AM

Re: How to display the lowest Wholesale price on the list of products (4.4.2)
 
Very helpful post Adam. Definitely appreciated as I was one who was looking for this. However, I cannot seem to find the products_list.tpl in the template files.

Edit: This is actually the correct path for the products_list.tpl skin/common_files/customer/main

Thanks again for the post though Adam !

adam.fearn 03-02-2011 01:16 AM

Re: How to display the lowest Wholesale price on the list of products (4.4.2)
 
Eep!

Sorry about that, fixed. :)


All times are GMT -8. The time now is 03:53 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.