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)
-   -   How can I insert a new option in Store Settings? (https://forum.x-cart.com/showthread.php?t=41957)

ADDISON 08-24-2008 10:57 PM

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

Piotr M. 08-25-2008 01:25 AM

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}


ADDISON 08-25-2008 02:28 AM

Re: How can I insert a new option in Store Settings?
 
Great job. :D/

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.

Piotr M. 08-25-2008 03:02 AM

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.

ADDISON 08-25-2008 04:01 AM

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.

Piotr M. 08-25-2008 04:18 AM

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}

ADDISON 08-25-2008 04:20 AM

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


All times are GMT -8. The time now is 10:23 AM.

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