X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   How to bulk change the price of ALL product (https://forum.x-cart.com/showthread.php?t=68664)

en4less 02-14-2014 11:01 AM

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.

cflsystems 02-14-2014 05:02 PM

Re: How to bulk change the price of ALL product
 
This is how - http://www.cflsystems.com/products-bulk-pricing-for-x-cart.html

rogue 02-16-2014 05:56 AM

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

RichieRich 03-10-2014 12:02 PM

Re: How to bulk change the price of ALL product
 
this can be achieved with one line in the SQL i believe

cflsystems 03-10-2014 02:18 PM

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

TA 11-19-2015 08:54 AM

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
:wink:

voodoo1967 02-03-2020 02:09 PM

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');

cheap eyeglasses 02-03-2020 02:52 PM

Re: How to bulk change the price of ALL product
 
run mysql via phpmyadmin

cflsystems 02-03-2020 03:44 PM

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.

voodoo1967 02-04-2020 01:30 AM

Re: How to bulk change the price of ALL product
 
1 Attachment(s)
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


All times are GMT -8. The time now is 03:48 AM.

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