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

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #51  
Old 05-15-2007, 12:54 PM
 
tony galfano tony galfano is offline
 

Newbie
  
Join Date: Mar 2007
Posts: 8
 

Default 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
__________________
Tony Galfano
LC 2.2.21
XCart Gold 4.18 w/Fashoin Mosaic Skin
XCart Gold 4.18
Reply With Quote
  #52  
Old 05-15-2007, 01:03 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

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

Tony, try this thread:

http://forum.x-cart.com/showthread.php?t=30979
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #53  
Old 05-15-2007, 01:37 PM
 
tony galfano tony galfano is offline
 

Newbie
  
Join Date: Mar 2007
Posts: 8
 

Default 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
LC 2.2.21
XCart Gold 4.18 w/Fashoin Mosaic Skin
XCart Gold 4.18
Reply With Quote
  #54  
Old 05-15-2007, 10:32 PM
 
tony galfano tony galfano is offline
 

Newbie
  
Join Date: Mar 2007
Posts: 8
 

Default 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
__________________
Tony Galfano
LC 2.2.21
XCart Gold 4.18 w/Fashoin Mosaic Skin
XCart Gold 4.18
Reply With Quote
  #55  
Old 07-11-2007, 07:24 AM
 
smek smek is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 54
 

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

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!
Attached Thumbnails
Click image for larger version

Name:	first category.jpg
Views:	258
Size:	62.7 KB
ID:	458  Click image for larger version

Name:	last category.jpg
Views:	237
Size:	58.4 KB
ID:	459  
__________________
xcart 4.5.2
Reply With Quote
  #56  
Old 07-12-2007, 09:09 AM
 
smek smek is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 54
 

Default 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?
__________________
xcart 4.5.2
Reply With Quote
  #57  
Old 08-10-2007, 07:40 AM
 
phoenixrider phoenixrider is offline
 

Member
  
Join Date: Aug 2007
Posts: 15
 

Default 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.
__________________
v 4.1.8
Reply With Quote
  #58  
Old 08-10-2007, 08:18 AM
 
smek smek is offline
 

Advanced Member
  
Join Date: Jan 2004
Posts: 54
 

Default 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.
__________________
xcart 4.5.2
Reply With Quote
  #59  
Old 12-31-2007, 10:37 PM
 
typologist typologist is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 51
 

Default 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}
__________________
4.1.8 Gold (Unix)
Reply With Quote
  #60  
Old 02-02-2008, 03:26 AM
 
davej2k davej2k is offline
 

Advanced Member
  
Join Date: Sep 2007
Posts: 47
 

Default 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?
__________________
www.qcum.co.uk
version: 4.1.8
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:09 PM.

   

 
X-Cart forums © 2001-2020