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)
-   -   common if/then modifications I make to x-cart... (https://forum.x-cart.com/showthread.php?t=8881)

tony galfano 05-15-2007 12:54 PM

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

Great stuff here! I'm a newbie with xcart and smarty and am having some problems hiding the pricing and buying abilty from all but one membership group. I have a category with 42 subcategories with 12 products in each that are only for sale to Wholesale members. However, the client wants all visitors to see these products and only make them available for sale to wholesale members. So, he wants to hide the prices from regular visitors.

I was reall encouraged by this post and am trying to use if/then logic based on one of the examples above to accomplish this. Seems to me that the products _t.tpl and the products.tpl need to be modified?

Here's what I tried in the products_t.tpl:

{if $user_membership eq "Wholesale"}
<font class="ProductPrice">{$lng.lbl_our_price}: {include file="currency.tpl" value=$products[product].taxed_price}</font><br /><font class="MarketPrice">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$products[product].taxed_price}</font>{if $discount gt 0}{if $config.General.alter_currency_symbol ne ""},{/if} {$lng.lbl_save_price} {$discount}%{/if}
{if $products[product].taxes}<br />{include file="customer/main/taxed_price.tpl" taxes=$products[product].taxes}{/if}
{if $active_modules.Special_Offers ne "" and $products[product].use_special_price ne ""}
{include file="modules/Special_Offers/customer/product_special_price.tpl" product=$products[product]}
{/if}
{else}
<font class="ProductPrice">{$lng.lbl_enter_your_price}</font>
{/if}
{/if}
{else}
Wholesale Only
{/if}

I was trying to get the price to show up only if the user is logged in as a Wholesale member, and if not, to show "Wholesale Only". But this just causes the page to display code where images should be and blows the page formatting apart.

The solution can't be far from this and I'm continueing to hack away. Any help is greatly appreciated.

Thanks in advance,

Tony

balinor 05-15-2007 01:03 PM

Re: common if/then modifications I make to x-cart...
 
Tony, try this thread:

http://forum.x-cart.com/showthread.php?t=30979

tony galfano 05-15-2007 01:37 PM

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

Wow, thanks for the quick response! I tried that and couldn't get it to work either, though it did fix the page destruction issues. But what happens is that the prices don't show up for anyone in all of the categories.

I just want to have the products in the one category to have prices show up for only wholesale members. I still hacking away and am trying variations of the if/then statements and the placement of them in the code to see if I can get this to work.

Thanks for you help and if you can think of anything else fire away!

Thanks,

Tony

tony galfano 05-15-2007 10:32 PM

Re: common if/then modifications I make to x-cart...
 
Hi All,

Thanks for the great help. I've got this one licked now. I used a combination of balinar's code and on of the examples earlier on in this thread. My mistake was that I was not addressing the subcategory, but the root category. The code on the product.tpl only relates to the subcaetgory if the product is not in a root category.

Once I fixed it your code worked like a charm!

Thanks,

Tony

smek 07-11-2007 07:24 AM

Re: common if/then modifications I make to x-cart...
 
2 Attachment(s)
Thanks everyone, this thread has saved me countless hours! However, I am having a small cosmetic problem...I setup a long list of "if statements" so that each category would show a specific flash banner. This works well, however, since it is several lines of code, the first IFSTATEMENT goes into effect it is fine because it is the first line. BUT if lets say the last piece of code goes into effect there is a big space above it where the other inactive coding was. Its best to look at the pictures: Here are some attached examples.

EXAMPLE:
Code:

{if $cat eq "1"} FLASH BANNER FOR FRAGRANCES WILL GO HERE {/if}

I've tried adding the code to a sepearte TPL file but that woudlnt parse correctly.
There must be an easy not to have the inactive code take up space....heres a brain buster for you experts but im sure this has been asked before....although i coudl not find anyting about this on this forum.


Thanks in ADVANCE!

smek 07-12-2007 09:09 AM

Re: common if/then modifications I make to x-cart...
 
nevermind it wasnt parsing correctly because of a typo...

the spaces can be seen in FIREFOX but dont exist in IE...any ideas?

phoenixrider 08-10-2007 07:40 AM

Re: common if/then modifications I make to x-cart...
 
smek - could you elaborate a bit more on how this works, or perhaps show some example code? This is what I am wanting to do as well. I tried it as a test on my site with what you had shown, didn't work.

Edit - get it. I had the wrong cat id# Cool.

smek 08-10-2007 08:18 AM

Re: common if/then modifications I make to x-cart...
 
i put all the if statements into a sepearate TPL file and call it from the home.tpl file....
but it still shows a space in firefox where the "unused code" is..perfect in IE though.

typologist 12-31-2007 10:37 PM

Re: common if/then modifications I make to x-cart...
 
I wanted to show something ONLY in the product.tpl pages and this code worked:
{if $product.productid ne "" }hello{/if}

davej2k 02-02-2008 03:26 AM

Re: common if/then modifications I make to x-cart...
 
Hi,
I want to add an extra line at the checkout summary page depending upon the value of a field called 'prodlocation'
The code I've insterted is:
Quote:

{if $products[prod_num].prodlocation eq "Dave"} show this {/if}

But the message isn't displayed.

If I enter:
{if $products[prod_num].prodlocation eq ""} show this {/if}

The message is shown which is strange as the value of prodlocation is Dave.

Any ideas?


All times are GMT -8. The time now is 02:17 AM.

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