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

How can I insert a new option in Store Settings?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-24-2008, 10:57 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default How can I insert a new option in Store Settings?

Hello Guys,

I would like to insert a new option in Store Settings. A check box for placing the currency in front or behind the price. By default to be in front of the price.

I know I should insert inside the database a new paramenter and use it with currency template. But how can I do that?

Thanks
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #2  
Old 08-25-2008, 01:25 AM
  Piotr M.'s Avatar 
Piotr M. Piotr M. is offline
 

Senior Member
  
Join Date: Aug 2008
Posts: 134
 

Default Re: How can I insert a new option in Store Settings?

You just need to run this SQL query
Code:
INSERT INTO `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`, `validation`) VALUES ('currency_sign', 'When checked, shows currency sign before price', 'N', 'Appearance', '450', 'checkbox', 'N', '', '');

Now you have this option in appearance section at the very bottom of page.

And here is currency.tpl
Code:
{* $Id: currency.tpl,v 1.13.2.1 2006/04/29 06:36:56 max Exp $ *} {if $plain_text_message eq ""}<span style="WHITE-SPACE: nowrap">{/if}{if $display_sign}{if $value gte 0}+{else}-{/if}{/if}{if $config.Appearance.currency_sign eq "Y"}{$config.General.currency_symbol}{/if}{$value|abs_value|formatprice}{if $config.Appearance.currency_sign ne "Y"}{$config.General.currency_symbol}{/if}{if $plain_text_message eq ""}</span>{/if}
__________________
Regards,
Piotr Markushin

X-Cart PDF Catalog Generator NEW
Professional X-Cart Skins Store (7 new skins added in August 2008!)

ahedOffice.com - Web 2.0 Online Groupware
Reply With Quote
  #3  
Old 08-25-2008, 02:28 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: How can I insert a new option in Store Settings?

Great job.

1. Now, how can I do this for Admin section? Inserting the check box and process the form?

2. How can I make a patch for adding easy this option to my shop?

Thanks.
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #4  
Old 08-25-2008, 03:02 AM
  Piotr M.'s Avatar 
Piotr M. Piotr M. is offline
 

Senior Member
  
Join Date: Aug 2008
Posts: 134
 

Default Re: How can I insert a new option in Store Settings?

You should just go to Admin backoffice, Path/Upgrade section.

At the section Apply SQL patch insert the code I've posted and press apply button. That's all.
__________________
Regards,
Piotr Markushin

X-Cart PDF Catalog Generator NEW
Professional X-Cart Skins Store (7 new skins added in August 2008!)

ahedOffice.com - Web 2.0 Online Groupware
Reply With Quote
  #5  
Old 08-25-2008, 04:01 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: How can I insert a new option in Store Settings?

I would like to have in Admin -> Store configuration this check box, placing currency in front or behind the price. You gave me the solution only for the Front-End.

Thanks.
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #6  
Old 08-25-2008, 04:18 AM
  Piotr M.'s Avatar 
Piotr M. Piotr M. is offline
 

Senior Member
  
Join Date: Aug 2008
Posts: 134
 

Default Re: How can I insert a new option in Store Settings?

Quote:
Originally Posted by am2003
I would like to have in Admin -> Store configuration this check box, placing currency in front or behind the price. You gave me the solution only for the Front-End.
Thanks.

Go to http://www.yoursite.com/xcart/admin/configuration.php?option=Appearance
At the very bottom, inside Miscellaneous section there is this checkbox.
if you want it to be placed directly at http://www.yoursite.com/xcart/admin/configuration.php

then use this code
Code:
INSERT INTO `xcart_config` (`name`, `comment`, `value`, `category`, `orderby`, `type`, `defvalue`, `variants`, `validation`) VALUES ('currency_sign', 'When checked, shows currency sign before price', 'N', 'General', '4', 'checkbox', 'N', '', '');

And currency.tpl
Code:
{if $plain_text_message eq ""}<span style="WHITE-SPACE: nowrap">{/if}{if $display_sign}{if $value gte 0}+{else}-{/if}{/if}{if $config.General.currency_sign eq "Y"}{$config.General.currency_symbol}{/if}{$value|abs_value|formatprice}{if $config.General.currency_sign ne "Y"}{$config.General.currency_symbol}{/if}{if $plain_text_message eq ""}</span>{/if}
__________________
Regards,
Piotr Markushin

X-Cart PDF Catalog Generator NEW
Professional X-Cart Skins Store (7 new skins added in August 2008!)

ahedOffice.com - Web 2.0 Online Groupware
Reply With Quote
  #7  
Old 08-25-2008, 04:20 AM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: How can I insert a new option in Store Settings?

Thanks this example give me a lot of idea about inserting new features.

Cheers
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
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 03:05 AM.

   

 
X-Cart forums © 2001-2020