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

How to bulk change the price of ALL product

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 02-14-2014, 11:01 AM
 
en4less en4less is offline
 

Newbie
  
Join Date: Apr 2007
Posts: 7
 

Default How to bulk change the price of ALL product

anybody has any idea how to do this, please share.
Let's say the price of all my products increased $5. How do we add $5 to the price of all products? Of course we don't want to go to 1000's of products and edit one at a time.

I think we have to go to the php codes and modify the price variable, but not where what file.

Any inputs will be appreciated very much. Thank you.
__________________
en
Reply With Quote
  #2  
Old 02-14-2014, 05:02 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default Re: How to bulk change the price of ALL product

This is how - http://www.cflsystems.com/products-bulk-pricing-for-x-cart.html
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 02-16-2014, 05:56 AM
  rogue's Avatar 
rogue rogue is offline
 

X-Adept
  
Join Date: Apr 2007
Location: Loveland, Ohio
Posts: 770
 

Default Re: How to bulk change the price of ALL product

You can do this by:
- Export your products
- Import into Excel
- Delete all columns except for productcode and price
- Rename price column to old_price
- Add a new column new_price with formula to adjust old price as desired.
- Copy values of of new_price to another new column called price.
- Delete the old_price and new_price column leaving only productcode and price
- Export to CSV
- Import to store
__________________
Richard Williams
Rogue Wave Limited

Initial Inventory Imports
Daily Inventory Updates
Daily Inventory Reports
Drop Ship Support
Order Export to Shipper/Supplier
Shopping Feeds That Work
Programming for X-Cart

richard@roguewavelimited.com
http://www.roguewavelimited.com
Reply With Quote

The following user thanks rogue for this useful post:
tartaglia (02-19-2014)
  #4  
Old 03-10-2014, 12:02 PM
  RichieRich's Avatar 
RichieRich RichieRich is offline
 

X-Adept
  
Join Date: Sep 2004
Location: London, England
Posts: 750
 

Default Re: How to bulk change the price of ALL product

this can be achieved with one line in the SQL i believe
__________________
Richard


Ultimate 5.4 testing
Reply With Quote

The following user thanks RichieRich for this useful post:
cflsystems (03-10-2014)
  #5  
Old 03-10-2014, 02:18 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default Re: How to bulk change the price of ALL product

Quote:
Originally Posted by RichieRich
this can be achieved with one line in the SQL i believe

No you cannot. You can change the price in pricing table with simply sql statement but XC uses quick tables to cache and for faster access to pricing, also there is different pricing depending variants, options, membership, etc. so the one line sql statement may not be enough
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #6  
Old 11-19-2015, 08:54 AM
 
TA TA is offline
 

eXpert
  
Join Date: Apr 2006
Posts: 303
 

Default Re: How to bulk change the price of ALL product

Or you could just do this. https://www.cflsystems.com/products-bulk-prices-for-x-cart-classic.html
__________________
v4.7.12
v5.4.x (In Dev)
Reply With Quote

The following user thanks TA for this useful post:
cflsystems (11-19-2015)
  #7  
Old 02-03-2020, 02:09 PM
 
voodoo1967 voodoo1967 is offline
 

X-Adept
  
Join Date: Sep 2009
Posts: 431
 

Default Re: How to bulk change the price of ALL product

Quote:
Originally Posted by TA

Is the mod 4.7.11 ready ?

Just ran the install - sql patches success, files uploaded ok, and file changes ok - cleared cache. Created a dummy directory and product. Applied bulk discount - increased by $1

and got this in the admin dashboard :-

* @copyright Copyright (c) 2015 CFL Systems, Inc. All rights reserved. * @license CFL Systems Software License Agreement - https://www.cflsystems.com/software-license-agreement.html * @link https://www.cflsystems.com/products-bulk-prices-for-x-cart-classic.html */if ( !defined('XCART_START') ) { header("Location: ../../"); die("Access denied"); }function csi_get_productcode($pid) { global $sql_tbl; $tbl = 'variants'; $field = 'variantid'; $tmp = func_query_first_cell("SELECT variantid FROM $sql_tbl[pricing] WHERE priceid = '$pid'"); if ($tmp == 0) { $tmp = func_query_first_cell("SELECT productid FROM $sql_tbl[pricing] WHERE priceid = '$pid'"); $tbl = 'products'; $field = 'productid'; } $productcode = func_query_first_cell("SELECT productcode FROM $sql_tbl[$tbl] WHERE $field = '$tmp'"); return $productcode;}if ( $pricing_amount < 0 || !is_numeric($pricing_amount)) { $pricing_amount = 0;}$pricing_amount = floatval($pricing_amount);if ( $pricing_amount == 0 || (empty($cats) && empty($mans))) { $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_error') ; $top_message['type'] = 'E'; $mode = ''; func_header_location($current_location . '/admin/products_bulk_pricing.php?err=1');}$join = array();$where = array();if (!empty($mans)) { $mans = implode(',', $mans); $where[] = "$sql_tbl[products].manufacturerid IN ($mans)";}if (!empty($cats)) { $cats = implode(',', $cats); if ($only_main_cat == 'Y') { $where[] = "$sql_tbl[products_categories].categoryid IN ($cats) AND $sql_tbl[products_categories].main = 'Y'"; } else { $where[] = "$sql_tbl[products_categories].categoryid IN ($cats)"; } $join[] = "LEFT JOIN $sql_tbl[products_categories] ON $sql_tbl[products].productid = $sql_tbl[products_categories].productid";}$join = implode(' ', $join);$where = empty($where) ? '' : 'WHERE ' . implode(' AND ', $where);$productids = func_query_column("SELECT $sql_tbl[products].productid FROM $sql_tbl[products] $join $where");unset($where);if (!empty($productids)) { $skipped_products = array(); $where = array(); $where[] = "productid IN (" . implode(',', $productids) . ")"; if (!empty($pricing_wholesale)) { $where[] = 'quantity = 1'; } if (!empty($memberships)) { $memberships = implode(',', $memberships); $where[] = "membershipid IN ($memberships)"; } $where = empty($where) ? '' : 'WHERE ' . implode(' AND ', $where); $priceids = func_query("SELECT priceid, price FROM $sql_tbl[pricing] $where"); if (!empty($priceids)) { foreach ($priceids as $k=>$v) { if ($pricing_type == 'percent') { $diff = $v['price'] * $pricing_amount / 100; } elseif ($pricing_type == 'fixed') { $diff = $pricing_amount; } if ($pricing_direction == 'up') { $newprice = $v['price'] + $diff; } elseif ($pricing_direction == 'down') { $newprice = $v['price'] - $diff; } if (!empty($pricing_round)) { $newprice = round($newprice); } if ($newprice <= 0) { $skipped_products[] = csi_get_productcode($v['priceid']); continue; } db_query("UPDATE $sql_tbl[pricing] SET price = $newprice WHERE priceid = " . $v['priceid']); } foreach ($productids as $p) { func_build_quick_prices($p); func_build_quick_flags($p); } $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_updated '); $top_message['type'] = 'I'; $smarty->assign('skipped_products', $skipped_products); } else { $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_no_prod ucts'); $top_message['type'] = 'I'; } } else { $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_no_prod ucts'); $top_message['type'] = 'I';}func_header_location($current_location . '/admin/products_bulk_pricing.php');
__________________
x-cart Gold Plus 4.7.12
CDSEO Pro latest ver
ReDux template xcartmods.co.uk - it's great
php 7.x
Reply With Quote
  #8  
Old 02-03-2020, 02:52 PM
 
cheap eyeglasses cheap eyeglasses is offline
 

Senior Member
  
Join Date: Oct 2010
Posts: 144
 

Default Re: How to bulk change the price of ALL product

run mysql via phpmyadmin
Reply With Quote
  #9  
Old 02-03-2020, 03:44 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default Re: How to bulk change the price of ALL product

Quote:
Originally Posted by voodoo1967
Is the mod 4.7.11 ready ?

Just ran the install - sql patches success, files uploaded ok, and file changes ok - cleared cache. Created a dummy directory and product. Applied bulk discount - increased by $1

and got this in the admin dashboard :-

* @copyright Copyright (c) 2015 CFL Systems, Inc. All rights reserved. * @license CFL Systems Software License Agreement - https://www.cflsystems.com/software-license-agreement.html * @link https://www.cflsystems.com/products-bulk-prices-for-x-cart-classic.html */if ( !defined('XCART_START') ) { header("Location: ../../"); die("Access denied"); }function csi_get_productcode($pid) { global $sql_tbl; $tbl = 'variants'; $field = 'variantid'; $tmp = func_query_first_cell("SELECT variantid FROM $sql_tbl[pricing] WHERE priceid = '$pid'"); if ($tmp == 0) { $tmp = func_query_first_cell("SELECT productid FROM $sql_tbl[pricing] WHERE priceid = '$pid'"); $tbl = 'products'; $field = 'productid'; } $productcode = func_query_first_cell("SELECT productcode FROM $sql_tbl[$tbl] WHERE $field = '$tmp'"); return $productcode;}if ( $pricing_amount < 0 || !is_numeric($pricing_amount)) { $pricing_amount = 0;}$pricing_amount = floatval($pricing_amount);if ( $pricing_amount == 0 || (empty($cats) && empty($mans))) { $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_error') ; $top_message['type'] = 'E'; $mode = ''; func_header_location($current_location . '/admin/products_bulk_pricing.php?err=1');}$join = array();$where = array();if (!empty($mans)) { $mans = implode(',', $mans); $where[] = "$sql_tbl[products].manufacturerid IN ($mans)";}if (!empty($cats)) { $cats = implode(',', $cats); if ($only_main_cat == 'Y') { $where[] = "$sql_tbl[products_categories].categoryid IN ($cats) AND $sql_tbl[products_categories].main = 'Y'"; } else { $where[] = "$sql_tbl[products_categories].categoryid IN ($cats)"; } $join[] = "LEFT JOIN $sql_tbl[products_categories] ON $sql_tbl[products].productid = $sql_tbl[products_categories].productid";}$join = implode(' ', $join);$where = empty($where) ? '' : 'WHERE ' . implode(' AND ', $where);$productids = func_query_column("SELECT $sql_tbl[products].productid FROM $sql_tbl[products] $join $where");unset($where);if (!empty($productids)) { $skipped_products = array(); $where = array(); $where[] = "productid IN (" . implode(',', $productids) . ")"; if (!empty($pricing_wholesale)) { $where[] = 'quantity = 1'; } if (!empty($memberships)) { $memberships = implode(',', $memberships); $where[] = "membershipid IN ($memberships)"; } $where = empty($where) ? '' : 'WHERE ' . implode(' AND ', $where); $priceids = func_query("SELECT priceid, price FROM $sql_tbl[pricing] $where"); if (!empty($priceids)) { foreach ($priceids as $k=>$v) { if ($pricing_type == 'percent') { $diff = $v['price'] * $pricing_amount / 100; } elseif ($pricing_type == 'fixed') { $diff = $pricing_amount; } if ($pricing_direction == 'up') { $newprice = $v['price'] + $diff; } elseif ($pricing_direction == 'down') { $newprice = $v['price'] - $diff; } if (!empty($pricing_round)) { $newprice = round($newprice); } if ($newprice <= 0) { $skipped_products[] = csi_get_productcode($v['priceid']); continue; } db_query("UPDATE $sql_tbl[pricing] SET price = $newprice WHERE priceid = " . $v['priceid']); } foreach ($productids as $p) { func_build_quick_prices($p); func_build_quick_flags($p); } $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_updated '); $top_message['type'] = 'I'; $smarty->assign('skipped_products', $skipped_products); } else { $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_no_prod ucts'); $top_message['type'] = 'I'; } } else { $top_message['content'] = func_get_langvar_by_name('txt_bulk_pricing_no_prod ucts'); $top_message['type'] = 'I';}func_header_location($current_location . '/admin/products_bulk_pricing.php');




This is spitting out the content of the php file instead of running it.
Check what you have uploaded and that the actual files are php files. Are you running this on a working cart or newly installed test cart? If new make sure the server knows it has to process php files as php files and not just dump their content in the browser.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #10  
Old 02-04-2020, 01:30 AM
 
voodoo1967 voodoo1967 is offline
 

X-Adept
  
Join Date: Sep 2009
Posts: 431
 

Default Re: How to bulk change the price of ALL product

Yep running on a live cart - 4.7.11
Re checked files and uploaded again, uninstalled and re installed .sql patch via phpmyadmin - screen shot attached and cleared cache - still get the issue in the xcart dashboard - and when I load up the module - make the change - the changes arent made etc.

Triple checked this now and all is as according to the instructions , I cant see that Ive missed anything
Attached Thumbnails
Click image for larger version

Name:	bulkproducts-sql.jpg
Views:	1122
Size:	268.5 KB
ID:	5440  
__________________
x-cart Gold Plus 4.7.12
CDSEO Pro latest ver
ReDux template xcartmods.co.uk - it's great
php 7.x
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 08:33 AM.

   

 
X-Cart forums © 2001-2020