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

Global Variable

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 02-01-2011, 09:16 PM
 
thygtd thygtd is offline
 

Advanced Member
  
Join Date: Dec 2010
Posts: 31
 

Default Global Variable

Hi, Everyone

I need to create the Global Variable to access in all over the xcart pages. This values can be control from Admin side, because the values can be changed dynamically by administrator. Please suggest how to implement this.

Thanks
__________________
X-Cart/LiteCommerce version v4.4.1
Reply With Quote
  #2  
Old 02-04-2011, 06:08 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Global Variable

You can add a new option to the "xcart_config" table.

It will automatically appear in the X-Cart admin backend and will be available in both PHP code and templates (e.g. $config['General']['your_option_name'] & {$config.General.your_option}).

Check the "<xcart_dir>/sql/xcart_data.sql" file for sample INSERT SQL commands.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
thygtd (02-04-2011)
  #3  
Old 02-04-2011, 12:04 PM
 
thygtd thygtd is offline
 

Advanced Member
  
Join Date: Dec 2010
Posts: 31
 

Default Re: Global Variable

Alex,

My customer asked me to add common extra amount to all products. So i asked this global variable. I have added this extra values to the product which are displaying. But i have getting problem with mini cart and cart page. I cannot able to identify where i need to add this common values to calculate the price. can u please suggest me how to get this calculated values from beginning to end.

Thanks
__________________
X-Cart/LiteCommerce version v4.4.1
Reply With Quote
  #4  
Old 02-07-2011, 08:34 AM
 
thygtd thygtd is offline
 

Advanced Member
  
Join Date: Dec 2010
Posts: 31
 

Default Re: Global Variable

Hi,
Anyhelp? The xcart is for a jewelery shop. The client will be changing the products' price according to silver's market price. The price will be updated twice a day. So he needs to input the market price & makeover charges in one place at admin and the prices should change accordingly. Can somebody help with this? we need to finish this fast. Very urgent. Any help would be appreciated and Thanks in advance.
__________________
X-Cart/LiteCommerce version v4.4.1
Reply With Quote
  #5  
Old 02-08-2011, 06:43 AM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default Re: Global Variable

It sounds like you might be better off setting this up as a tax with the tax set to be displayed in the product price. See the manual on setting up taxes.
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote

The following user thanks geckoday for this useful post:
thygtd (02-08-2011)
  #6  
Old 02-08-2011, 10:52 AM
 
thygtd thygtd is offline
 

Advanced Member
  
Join Date: Dec 2010
Posts: 31
 

Post Re: Global Variable

Quote:
Originally Posted by qualiteam
You can add a new option to the "xcart_config" table.

It will automatically appear in the X-Cart admin backend and will be available in both PHP code and templates (e.g. $config['General']['your_option_name'] & {$config.General.your_option}).

Check the "<xcart_dir>/sql/xcart_data.sql" file for sample INSERT SQL commands.

Hi,
We followed your idea. Currently its working fine. But a problem occurs on mini cart and cart pages. The values added are not multiplied with no. of products added to cart. Can u shed some light on that? It would be great if u point us where the calculation(taxed price X quantity) is made. Thanks in advance.
__________________
X-Cart/LiteCommerce version v4.4.1
Reply With Quote
  #7  
Old 02-09-2011, 06:54 AM
 
geckoday geckoday is offline
 

X-Wizard
  
Join Date: Aug 2005
Posts: 1,073
 

Default Re: Global Variable

I don't run 4.4.1 so I can't test it on my setup but I did try it out on the X-Cart demo site and taxes are properly multiplied by the number of items and show properly in the extended product price mini-cart and cart pages (e.g. quantity of 3 shows 3 times the tax added into the total product price). Note that you must have "Presume that a not logged in customer is from the default country" checked in your general settings for the tax to show before someone logs in.
__________________
Manuka Bay Company
X-Cart Version 4.0.19 [Linux]

UGG Boots and other fine sheepskin products
http://www.snowriver.com
Reply With Quote

The following user thanks geckoday for this useful post:
thygtd (02-10-2011)
  #8  
Old 02-10-2011, 01:16 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Global Variable

You should alter the "include/func/func.cart.php" script -> function "func_calculate".
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
thygtd (02-10-2011)
  #9  
Old 02-10-2011, 04:42 AM
 
thygtd thygtd is offline
 

Advanced Member
  
Join Date: Dec 2010
Posts: 31
 

Default Re: Global Variable

Quote:
Originally Posted by geckoday
I don't run 4.4.1 so I can't test it on my setup but I did try it out on the X-Cart demo site and taxes are properly multiplied by the number of items and show properly in the extended product price mini-cart and cart pages (e.g. quantity of 3 shows 3 times the tax added into the total product price). Note that you must have "Presume that a not logged in customer is from the default country" checked in your general settings for the tax to show before someone logs in.
Thanks for the message geckoday! it helped, but unfortunately client doesn't wants to add it as tax and now implemented the concept suggested Alex. Thanks a lot for your time and help!
__________________
X-Cart/LiteCommerce version v4.4.1
Reply With Quote
  #10  
Old 02-10-2011, 04:43 AM
 
thygtd thygtd is offline
 

Advanced Member
  
Join Date: Dec 2010
Posts: 31
 

Default Re: Global Variable

Quote:
Originally Posted by qualiteam
You should alter the "include/func/func.cart.php" script -> function "func_calculate".
Going to try tht, will post an update asap. Thanks a bunch for helping.
__________________
X-Cart/LiteCommerce version v4.4.1
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:51 PM.

   

 
X-Cart forums © 2001-2020