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 09-11-2013 09:57 PM

Re: common if/then modifications I make to x-cart...
 
{$lng.your_variable_name}

It will appear blank if empty.

JacksmithxD 12-15-2013 04:45 PM

Re: common if/then modifications I make to x-cart...
 
Anyway to have an if statement to work just on a category page that displays the products? So far I can only see it working if it's 'xxx' but I need it to work on just the categorys with products listed on it.

:D

carpeperdiem 12-15-2013 05:15 PM

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

Originally Posted by JacksmithxD
Anyway to have an if statement to work just on a category page that displays the products? So far I can only see it working if it's 'xxx' but I need it to work on just the categorys with products listed on it.



How about:

{if $main eq "catalog" and $current_category.category ne ""}

This makes certain that there is a category that is not empty. This is the inverse of the homepage (where category will be empty).
Yes?

revolate 12-16-2013 02:21 AM

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

Originally Posted by carpeperdiem
How about:

{if $main eq "catalog" and $current_category.category ne ""}

This makes certain that there is a category that is not empty. This is the inverse of the homepage (where category will be empty).
Yes?


Didn't appear to work for my site, driving me insane lol.

Jon 12-16-2013 02:23 AM

Re: common if/then modifications I make to x-cart...
 
That if/else statement should work for all categories on all x-cart versions without fail. Usually I'll do the ID though just to be extra safe:

Code:

{if $main eq "catalog" AND $current_category.categoryid ne ""}Show Text{/if}

revolate 12-16-2013 02:26 AM

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

Originally Posted by Jon
That if/else statement should work for all categories on all x-cart versions without fail. Usually I'll do the ID though just to be extra safe:

Code:

{if $main eq "catalog" AND $current_category.categoryid ne ""}Show Text{/if}


I have this below:

{if $main eq "catalog" AND $current_category.categoryid ne ""}
{include file="modules/Refine_Filters/customer_filter.tpl"}
{/if}

Trying to make the filter only work on the last categories the page with products showing in a list.

Having it on every category isn't what I need. (Hope I'm explaining my self right)

Cheers guys

Jon 12-16-2013 02:32 AM

Re: common if/then modifications I make to x-cart...
 
On the last categories the page?

revolate 12-16-2013 02:43 AM

Re: common if/then modifications I make to x-cart...
 
Basically pages showing products, the filter appears on every category which looks poor, if it just appears on categories with products showing it would make my life easier lol

PhilJ 12-16-2013 07:05 AM

Re: common if/then modifications I make to x-cart...
 
Revolate, maybe try...
Quote:

{if $cat_products} ... {/if}

totaltec 12-16-2013 07:19 AM

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

Originally Posted by revolate
Basically pages showing products, the filter appears on every category which looks poor, if it just appears on categories with products showing it would make my life easier lol

I would setup a new checkbox on the category page in admin checked by default, then just uncheck it if I didn't want this element to show.

Jon 12-16-2013 10:17 AM

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

{if $main eq "catalog" AND $current_category.categoryid ne "" AND $products ne ""}
{include file="modules/Refine_Filters/customer_filter.tpl"}
{/if}


EnterWorld 02-28-2014 04:08 PM

Re: common if/then modifications I make to x-cart...
 
Is there a if statement for:

if product is in category ... than ...

cflsystems 02-28-2014 05:36 PM

Re: common if/then modifications I make to x-cart...
 
{if $product.categoryid eq 'XX'}...{/if}

Keep in mind though this is the main category the product is so if you have it assigned to more than one category it will not work for the additional categories. If you need it to work everywhere product shows it has to be custom coded.

EnterWorld 03-01-2014 03:00 PM

Re: common if/then modifications I make to x-cart...
 
Thank you for the fast answer. But it doesn't work.

Do i also need to edit some php file to make that code work on the category page of my shop?

cflsystems 03-01-2014 08:55 PM

Re: common if/then modifications I make to x-cart...
 
Look in the debug console if categoryid even exists for the products array, you can use the webmaster mode to show the debug console

Natures Elements 04-30-2014 03:41 PM

Re: common if/then modifications I make to x-cart...
 
I am interested in the if/then modification #10. I need to do something similar. Is it possible to have a payment method not show up if a certain product option is selected? More specifically I have a product option called 'auto-ship' that if if is selected as 'No' I want the customer to have PayPal checkout as an option, however if they choose 'Yes' for this product option I do not want the PayPal option to be available during checkout. Any information/ advise would be very helpful and appreciated. Thank you.

totaltec 05-01-2014 09:03 AM

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

Originally Posted by Natures Elements
I am interested in the if/then modification #10. I need to do something similar. Is it possible to have a payment method not show up if a certain product option is selected? More specifically I have a product option called 'auto-ship' that if if is selected as 'No' I want the customer to have PayPal checkout as an option, however if they choose 'Yes' for this product option I do not want the PayPal option to be available during checkout. Any information/ advise would be very helpful and appreciated. Thank you.

Its probably going to take some PHP work, you need to loop through all the products in the cart looking for this option, then if found assign a variable that you can use in the template to formulate your if statement.

xtech 10-06-2014 12:22 AM

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

Originally Posted by totaltec
Look near line 1274 of include/register.php
Code:

// Redirect just registered customer
        if ($isAutoLogin) {
            $script = 'address_book.php';
        } else {
            $script = 'home.php';
        }



How to achieve this?

If any customer directly register in the cart by clicking register.php without adding product in the cart will redirect to home page and if any customer added product in the cart and then click register.php then how to redirected that customer to address book page?

anandat 12-24-2016 07:26 AM

Re: common if/then modifications I make to x-cart...
 
I want to display extra field #6 (name = publisher) in admin email invoice. I tried adding following code in skin\common_files\mail\html\order_data.tpl
PHP Code:

{if $show_order_details eq 'Y'}<span> - {$product.extra_fields|$product.Publisher} {/if} 

But that doesn't display value of extra field id 6 (Publisher).

Does any one know how to achieve this ?


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

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