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)

Jon 10-09-2008 12:15 PM

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}

Brian Schade 10-23-2008 03:56 PM

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.

Kara 11-06-2008 12:32 PM

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.8)

Kara 11-06-2008 01:11 PM

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.

ChrisP05 12-02-2008 02:21 PM

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

HWT 12-07-2008 10:37 AM

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}


donavichi 12-18-2008 03:25 PM

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

:D/

balinor 12-18-2008 04:22 PM

Re: common if/then modifications I make to x-cart...
 
Good one for this thread, so I'm moving it here :)

iWD 01-19-2009 01:44 PM

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!

Jon 01-19-2009 01:50 PM

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}


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

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