View Single Post
Old 05-25-2005, 11:10 AM
IndieDepot IndieDepot is offline

Advanced Member
Join Date: May 2005
Posts: 30

Default Re: common if/then modifications I make to x-cart...

Originally Posted by instinctual
4. Ugh, onto #4, will dig up #3 again in a bit So..another common one I use is to have different "buy now" buttons for different categories of products. In this case, I am usually working with either products.tpl or products_t.tpl - depending on your site layout. In example, here is a recent if/then I used in products.tpl that will display a different "buy now" button depending on whether or not the category is #5 -

{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y" and $products[product].categoryid ne "5"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{include file="customer/main/member_buy_now.tpl" product=$products[product]}

Notice the "and $products[product].categoryid ne "5" part - - this is where you can change the categoryid number you're trying to affect. So above, I'm saying if the category # is not equal to "5" - then display the normal include - if not - and the category DOES equal five, display the special include. Of course, you'll have to copy "buy_now.tpl", make your own, and call it in the tag above. This works in ANY version of x-cart.

Unfortunately #4 does not work in 4.0.13. I guess this was a solution for earlier versions of X-Cart. it would have been nice though. I guess now X-Cart doesn't list the 'categoryid' with the product tables anymore. And therefore you can grab the category ID in the products.tpl file anylonger.

I sure wish I knew how to do this. I wish I knew how to do it for manufacturers too. I'd like to list the manufacturers in the sub-categories AND i would like to list the categories in the product profile. Alas, nobody knows how.

- Shannon
X-Cart version 4.0.13
PHP 4.3.10
MySQL 4.0.23
Web server Apache
Operation system Linux
Perl 5.008004
XML parser (expat) 1.95.6
Reply With Quote