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)

donavichi 04-04-2011 04:51 AM

Re: common if/then modifications I make to x-cart...
 
X-Cart 4.4.x currently, but probably all previous versions are compatible also - I can't remember. Let me know if any problems...

Better Search Box:
If you want a custom search box on your X-Cart store that has an initial value of 'Search for products..." displayed, that when clicked turns blank so the user can type their search term without having to remove the text by hand & then when the search results are displayed, retains the term they just entered until they click back inside the box again, do this:

in customer/search.tpl find the following code (around line 20):

Code:

<input type="text" name="posted_data[substring]" class="text" value="{$search_prefilled.substring|escape}" />

and replace it with this:
Code:


<input type="text" name="posted_data[substring]" class="text" {if $main ne "search"}value="Search for products..." onfocus="if(this.value==this.defaultValue) this.value='';"{else}value="{$search_prefilled.substring|escape}" onfocus="if(this.value==this.defaultValue) this.value='';"{/if} />


Just done this for the nth time and thought it might help, in case anyone missed it.

CanadaPOS 04-08-2011 09:45 AM

Re: common if/then modifications I make to x-cart...
 
Trying to show an image on product.tpl only if wholesale prices are available for that product.

Is there an if statement that covers something like that?

Thanks in advance.

donavichi 04-08-2011 09:55 AM

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

{if $product_wholesale ne ""}...your image here...{/if}

that should do it.

Quote:

Originally Posted by CanadaPOS
Trying to show an image on product.tpl only if wholesale prices are available for that product.

Is there an if statement that covers something like that?

Thanks in advance.


CanadaPOS 04-08-2011 03:31 PM

Re: common if/then modifications I make to x-cart...
 
Thanks ... works great!!

mizNRG 04-13-2011 08:25 AM

Re: common if/then modifications I make to x-cart...
 
I'm looking for and if/then statement that would either clear out the email field if it equals dummyemail@email.com (thus requiring the customer to fill it in) or require the email field to be changed upon initial login if membership id = 8.

What I'm looking to accomplish is to import a large list of customers when I do not have their email addresses. I've come to the conclussion that I'll have to do this with a dummy email instead. However, I need to require the customer to change this so that they will properly receive notifications rather than the dummy email receiving them.

Any help on this would be greatly appreciated!!

upupcreative 04-16-2011 06:10 PM

Re: common if/then modifications I make to x-cart...
 
This may already have come up in this thread but I can't find it. I'm using 4.4.x and I don't seem to have a $user_membership variable. I want to use an if/then like the one above to show one thing on a static page if the user is a wholesale customer and something else if the user is not.

anandat 04-21-2011 11:03 PM

Re: common if/then modifications I make to x-cart...
 
I want if else statement for static page.
For example if visitor click on static page link. The following javascript should be load

Code:

<head>
<script language="Javascript" src="http://gd.geobytes.com/Gd?after=-1"></script>
<script language="javascript">
if(typeof(sGeobytesLocationCode)!="undefined"&&sGeobytesLocationCode.indexOf('US')==0)
{
    document.write("<META HTTP-EQUIV='Refresh' CONTENT='0; URL=http://www.SomeDomain.com'>");
}
</script>
</head>


In short what if/else condition I should put between <head> </head> so that above javascript function load if person open static page id=1 ?

PhilJ 04-21-2011 11:33 PM

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

{if $smarty.get.pageid eq "1"}
...
{/if}


godfatherantiques 06-02-2011 06:04 AM

Register as customer and provider on front end of site
 
What is needed to allow anybody to register as a customer and a provider. I'm thinking I need an {if statement to accomplish this, but I'm not quite sure what is needed. I'm hoping someone can point me in the right direction or tell me what needs to be done. I don't want the admin in control of creating provider accounts, but I would like to approve the providers as they sign up. Any help would be much appreciated.

dmpinder 07-29-2011 04:27 AM

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

Originally Posted by upupcreative
This may already have come up in this thread but I can't find it. I'm using 4.4.x and I don't seem to have a $user_membership variable. I want to use an if/then like the one above to show one thing on a static page if the user is a wholesale customer and something else if the user is not.


This should be close to what you need. I was having the same problem on my v4.3.1, and here is the solution:

1. In the file \include\check_useraccount.php find the following:
Code:

$mail_smarty->assign("usertype",$current_area);

... and paste underneath:
Code:

$smarty->assign("user_membership",$user_account["membership"]);
$smarty->assign("user_membershipid",$user_account["membershipid"]);



This allows you to call {$user_membership} or {$user_membershipid} in the Smarty template to generate the name and ID number.

Note: You can create other variables by using the $user_account database request on line 155.

Hope this helps!

Darren


All times are GMT -8. The time now is 06:31 PM.

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