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
  #91  
Old 10-09-2008, 12:15 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

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

Quote:
Originally Posted by qrichou
Hi,

Does anyone know if you can use like with smarty?

We want to say {if $products[product].productcode like "C-"}do this{else}dothis{/if}

Thanks

[code]
{assign var="truncCode" value=$products[product].productcode|truncate:2:""}
{if $truncCode eq "C-"}do this{else}do this instead{/if}
{/code}
Reply With Quote
  #92  
Old 10-23-2008, 03:56 PM
 
Brian Schade Brian Schade is offline
 

Member
  
Join Date: Apr 2008
Posts: 25
 

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

I need to format the invoices, both web-based and e-mail, to display information about how to pay via Check or Money Order (COMO). However, I only want this information to display if the person actually PAID by COMO. If the customer did not pay via COMO (in other words, paid by Gift Certificate, PayPal, or Credit Card) then the information specific to COMOs does not need to be shown or included in the e-mail.

I figured this would be a simple IF statement situation. But I'm not sure where to put the IF statement, or even on the syntax.

I have set up a new variable in my admin named eml_como. I figured the system would simply check the Payment Method variable and if it equalled "Check or Money Order" then it would simply display the eml_como value. I tried placing this IF statement in the signature.tpl file and using the $order.payment_method variable to check for the payment method. This appears to be the same variable that is used to display the payment method when generating the invoice to begin with. However, when I place the following code in my signature.tpl file;

Quote:
{if $order.payment_method == "Check or Money Order"}
{$lng.eml_como}
{/if}

I get no response at all.

I'm wondering if the problem lies in the fact that signature.tpl is a seperate template file than the template file that actually holds the value for that variable? The signature.tpl file, so far as I can tell, is called from two other templates; order_customer_processed.tpl and order_customer_complete.tpl. I'm guessing that this is the case. If this is true, where would be the best place to put the IF statement?

I really need to have this functionality built into our system. Any help would be greatly appreciated.
__________________
Brian Schade
Owner and CTO
Twilight Teez, LLC
www.twilightteez.com
X-Cart 4.1.9 GOLD
Reply With Quote
  #93  
Old 11-06-2008, 12:32 PM
  Kara's Avatar 
Kara Kara is offline
 

Advanced Member
  
Join Date: May 2006
Location: O'fallon, Missouri
Posts: 77
 

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

We are trying to hide our coupon code box from our wholesale customers.

We moved the coupon template to display just below the subtotal in cart_totals.tpl. This seems to work best because people are logged in when they have a chance to put in their coupon code, and it is much more visible to those trying to find where to enter the code.

This is what we have in cart_totals.tpl:

{if $membership_levels ne "Wholesale"}
{include file="modules/Discount_Coupons/add_coupon.tpl"}
{/if}

also tried {if $membership_levels.membership ne "Wholesale"}

It is still displaying the coupon box when logged in as a wholesale customer. Anyone have any ideas here? : )

(x-cart 4.1.
__________________
x-cart gold 4.6

Kara Design Group, Inc.
http://www.karadesigngroup.com
Professional Creative Services
Reply With Quote
  #94  
Old 11-06-2008, 01:11 PM
  Kara's Avatar 
Kara Kara is offline
 

Advanced Member
  
Join Date: May 2006
Location: O'fallon, Missouri
Posts: 77
 

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

figured it out:

{if $active_modules.Discount_Coupons ne "" and $userinfo.membership ne "Wholesale"}
{include file="modules/Discount_Coupons/add_coupon.tpl"}
{/if}

---------------------------------

Took me all day, but it works! Remember, this is in cart_totals.tpl where we moved the coupon code. -- not in cart.tpl where it normally is.
__________________
x-cart gold 4.6

Kara Design Group, Inc.
http://www.karadesigngroup.com
Professional Creative Services
Reply With Quote
  #95  
Old 12-02-2008, 02:21 PM
 
ChrisP05 ChrisP05 is offline
 

Member
  
Join Date: Dec 2005
Posts: 13
 

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

Hi All,

I am working on a x-cart v. 4.19 and the customer wants to have paid membership without having to manually assign customers to membership level. He has 3 levels active: Silver, Gold, and Platinum. The wholesale is not active but is still there.

Obviously, I can have the select memebrship level if I enable sign up for membership, but that would display all the levels. So if they chose to buy a silver level they could pick platinum at that stage. More manual work which is not wanted.

What I can come up with in theory is this:

1. The membership level selector has to be active, but hidden and selected by the product id in cart. Something like this:

if productid in cart is equal to "Silver" then the hidden select membership box = to silver.
if I could get that type of code even to work, would that automatically assign in the admin that user to that level?

Then on repeat orders that code would have to be inapplicable to platinum members with putting if product id is upgrade to Gold or Upgrade to platinum then hidden selector is = to gold or platinum {else} {if $login eq ""}comment out code {/if}

If that would even work, would that cause error in that since sign up for membership is enabled, would the cart be looking for that code?

To complicate things even further he has the customer loyalty points mod by bce and wants those points to be automatically credited to that new member on that purchase.

Thoughts?

Thanks

Chris
__________________
Chris
X-Cart 4.4.1 Unix
Reply With Quote
  #96  
Old 12-07-2008, 10:37 AM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

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

Here's and {if} that I believe I've seen alluded to, but I haven't figured out how to make happen.

Say I want to display something on products.tpl and/or product.tpl if a certain extra field has a particular value. How would one go about that?

eg:
Code:
{if $extrafield eq "0"}Choose ground shipping for Christmas delivery {elseif $extrafield eq "3"}Choose 3 day select for Chrismas delivery {elseif $extrafield eq "2"}Choose 2nd day air for Chrismas delivery {elseif $extrafield eq "1"}Choose next day air for Chrismas delivery {/if}
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #97  
Old 12-18-2008, 03:25 PM
 
donavichi donavichi is offline
 

X-Adept
  
Join Date: Apr 2004
Location: United Kingdom
Posts: 697
 

Default if section = FAQ / Terms / Contact etc...

I was looking for a solution to help me add content into a page which would change depending on which section of the help zone i was in.

I found plenty of questions asking for the same solution, but no answers.

I took a few moments out to deduce it myself and here is the solution:

Code:
{if $main eq "help" and $help_section eq "FAQ"} show this {elseif $main eq "help" and $help_section eq "contactus"} show something else {elseif $main eq "help" and $help_section eq "business"} show something different again... {/if}

...and so on.


To determine which areas of the help zone to alter, refer to skin1/help/index.tpl for the various parts of x-cart's help zone.

hope this helps

__________________
Best regards,

Donavichi.
- - -

Website Copywriting || Web Design || FAQs || Home & Garden Blog
Reply With Quote
  #98  
Old 12-18-2008, 04:22 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...

Good one for this thread, so I'm moving it here
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #99  
Old 01-19-2009, 01:44 PM
 
iWD iWD is offline
 

Advanced Member
  
Join Date: Jul 2008
Posts: 57
 

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

I have been trying to get a if/then statement working and so far I'm at a loss.
I want to have an image for the background on the regular pages, but when you got the cart portion (where all your menus disappear) that it is just plain white (or that the image turns off).

How and where do I make the if then statement to make this work?

any help would be appreciated!
thanks!
__________________
iWD
X-Cart: v4.1.10
PHP: 5.2.6
Host: Hands-on Web Hosting ( Linux )
MySQL: 4.1.22
Add ons: On Sale
2TC - JB AutoShip
Reply With Quote
  #100  
Old 01-19-2009, 01:50 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

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

You'd make the if statement around your image code:

{if $main ne "cart" AND $mode ne "checkout" AND $mode ne "order_message"}
Show the background image
{/if}
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:19 PM.

   

 
X-Cart forums © 2001-2020