Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 03-01-2011, 07:50 AM
 
Hamco Hamco is offline
 

Member
  
Join Date: Jan 2011
Location: KCK
Posts: 16
 

Default 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 !
__________________
Newest Xcart Version 4.4
Reply With Quote
  #3  
Old 03-02-2011, 01:16 AM
 
adam.fearn adam.fearn is offline
 

Newbie
  
Join Date: Jan 2011
Posts: 8
 

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

Eep!

Sorry about that, fixed.
__________________
X-Cart Gold, version 4.4.2.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:57 AM.

   

 
X-Cart forums © 2001-2020