Changing prices on multiple products

  • Posts: 299
  • Thank you received: 2
9 years 6 months ago #204110

-- url of the page with the problem -- : www.bil-filtertjanst.se
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : N/A
-- Browser(s) name and version -- : Any

Hi,
On one of my sites we are selling different filters for vehicles, such as oil filter, dust fislter, air filters etc.
We have set up a filtering function where you can find all filters encessary for your brand=>model=>submodel of vehicle. Some filters for example B982 Oil filter is usable on many different brands and models and on some models one is necessary and some two or even three filters. As you can see in the end some products/filters fits under a lot of different vehicles. Now I wonder
1. If there is a way to set up a filter many times under different product/brand categories?
As far as I can understand each product can only be set up one time witgh one coupon. The way the filtering system works I have to set it up like this:
Brand => Sub brand => Model (is set up like a custom field)
This filtering thing is a custom programmed module made by a freelancing programmer
When this field is setup you tell the module (that has no position) that this field should be activated.
Then you can under each product setup in the Brands field choose sub-brand then in the bottom of the product setup you find all custom fields and their values (models of machines) so you foirst have to choose Sub-brand then machine model under the custom fields.
This is why you have to enter a new coupon value for each product even if it is the same product so I wonder if there is any other way to solve the product diffrentiation in HikaShop.
Ai mean this way I can get hundreds of different products even if it is the same poduct physically withe the same price.
So to administer the pricing I have to enter the same price hundreds of times when I need to change the price for a product/filter.
Any ideas on how to solve this?

Thanks
Micke

Please Log in or Create an account to join the conversation.

  • Posts: 26166
  • Thank you received: 4029
  • MODERATOR
9 years 6 months ago #204174

Hi,

I'm sorry but I am not able to understand your question.

But yes, you can edit product price using mass actions. With a fixed value, manually with dynamic display/edition or with operators.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 299
  • Thank you received: 2
9 years 6 months ago #204198

Hi,
Never mind my bad explanation of the filtering module.
The thing is that we need some smart way to change price of all oilfilters for example B975.
I don't understand how to do that mass action and how do you mean?

I have for example the name Oilfilter then coupon B975_XX, B975_XY, B975_01 etc etc there can be a lot of them but if we say have 200 different coupon codes for the same product and the price is the same for one pice then I need to be able to change that price in one place for all of those variations.
I guess you told me how but I don't understand how to do that, sorry.

Best regards,
Micke

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #204207

Hi,

So you have a main product, in this case an oilfilter with the code B975, then this product has variants like B975_XX, B975_XY, B975_01, etc. Right ?

If it is, to update the price of that product and its variants via the mass actions, you have to set it up like that:
take.ms/OFR8P

This will increase the price of each variants by 20%

Please Log in or Create an account to join the conversation.

  • Posts: 299
  • Thank you received: 2
9 years 6 months ago #204287

Hi,
Well no it's the same product but because of the fltering functions way to work I have to add one product multiple times under each series under the Brand that is the prime level of the fltering,
The hierarchy of the filtering is like this:
Filter picker no 1: Brand
Filter picker no 2. Series of that brand
Filter picker no 3. Models of that brand
Listing Result:
1. Olilfilters
2. Air filters
3. Cabin fiters etc.
And it is only possible to display a product under each series of the brand so if a series has 15 models under it then I can set up one filter for all those models. But only one filter per series under each brand.
I have today like 250 Brands and in average like 3-4 series under each which makes it necessary to enter some very common filters 750 - 1000 times even if if it's the same filter.
That is why I have to change the coupon to differentiate the product under each series even if they actualyy are the same product. Otherwise it is impossible to add this product under all different series.
So a kind of mass action to set up price changes to all in one go would helo extremely much. But how?

Regards
Micke

Last edit: 9 years 6 months ago by LAMF. Reason: change information

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #204362

Hi,

Ok so you have copies of a product, all starting by B975 and you want to update their prices (for every filter).
It is the same product but with one instance for every categories, etc.

In all cases, you have to set up your mass action as showed in the screenshot of my previous post.
This will update all the prices ;)

Don't forget to make a backup before using any mass actions.

Please Log in or Create an account to join the conversation.

  • Posts: 299
  • Thank you received: 2
9 years 6 months ago #204380

HI,
Oh I didn'tsee the screenshot link.
In that example it is called product_code is that the same as coupon in the product edit view?
Also the price.price_valude*1.2 mean a price rising with 20% on all products that has the product code B975xxxx ?
If so it is very nice and exactly what I am looking for.

Please Log in or Create an account to join the conversation.

  • Posts: 83024
  • Thank you received: 13403
  • MODERATOR
9 years 6 months ago #204417

Hi,

Yes that's what it does.

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
9 years 4 months ago #211245

Hi

I will raise the price from 13 to 14
how do I do this

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #211265

Hi,

You can set up your mass action like that: take.ms/AhUnr

So filter on the price value, and update the price value.

Please Log in or Create an account to join the conversation.

  • Posts: 299
  • Thank you received: 2
9 years 3 months ago #212671

HI,
Just to clarify if I have a product code like this example B975 and hve the price 45 on all those and want to change it to 48 then it woud be
easy to use the first screenshot example and change the Actions like the last example with price_value = INT and the value of 48 in the last field.
That would change the price on all instance of products with product_code B975 to 48.
Am I correct?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 3 months ago #212693

Hi,

Yes indeed, but if you specify a product_code, this action will be applied only on one product, because each product has a unique product code. But if you use the "LIKE" operator in the mass action filter, so you can get all the products with a product code having "B975".

The following user(s) said Thank You: LAMF

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
8 years 11 months ago #225200

Hi

I have tried to do as mentioned above, but get the error: PRICE_VALUE does not exist

what went wrong

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #225231

Hi,

Please give us a screenshot of your mass action settings.
What have you entered in the action value field ? if you set "price_value+2" for example, then try "price.price_value+2".

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
8 years 11 months ago #225282
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #225285

Hi,

We had an issue with the current version of HikaShop for the decimals and regarding the column names.
This will be fixed in the next release but for now please use the code:

hk_price.price_value*1.25

Please Log in or Create an account to join the conversation.

  • Posts: 3
  • Thank you received: 0
8 years 11 months ago #225381

Then I got this:


Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
8 years 11 months ago #225391

Hi,

Please edit the file "administrator/components/com_hikashop/classes/massaction.php" and replace the function "updateValueSecure()" by:

	function updateValuesSecure(&$action,&$possibleTables = array(),&$queryTables = array()){
		$db = JFactory::getDBO();
		$app = JFactory::getApplication();
		$tableType = explode('_',$action['type']);

		// Special cases
		if(preg_match('/order_product/',$action['type'])) $tableType = array('order_product');
		if($tableType[0] == 'joomla') $queryTables[] = $tableType[0].'_'.$tableType[1];
		else $queryTables[] = $tableType[0];

		// check if the column type match with the action type
		$mainFields = array();
		foreach($possibleTables as $possibleTable){
			if(!is_string($possibleTable)) continue;
			if(version_compare(JVERSION,'3.0','<')){
				if(preg_match('/joomla_/',$possibleTable)){
					$fieldsTable = $db->getTableFields('#__'.str_replace('joomla_','',$possibleTable));
					$fields = reset($fieldsTable);
//					foreach($fields as $key => $field){
//						$fields['joomla_'.$key] = $fields[$key];
//						unset($fields[$key]);
//					}
					$fieldsTable = $fields;
				}
				else{
					$fieldsTable = $db->getTableFields('#__hikashop_'.$possibleTable);
					$fields = reset($fieldsTable);
				}
			} else {
				if(preg_match('/joomla_/',$possibleTable)){
					$fields = $db->getTableColumns('#__'.str_replace('joomla_','',$possibleTable));
//					foreach($fields as $key => $field){
//						$fields['joomla_'.$key] = $fields[$key];
//						unset($fields[$key]);
//					}
				}
				else $fields = $db->getTableColumns('#__hikashop_'.$possibleTable);
			}
			$mainFields = array_merge($mainFields,$fields);
		}

		foreach($mainFields as $key => $field){
			$field = str_replace(',','',$field);
			if($key == $action['type']){
				switch($action['operation']){
					case 'int':
						if(in_array($field,array('boolean'))){
							 $app->enqueueMessage(JText::sprintf( 'WRONG_COLUMN_TYPE', $field));
							 $queryTables = '';
						}
						break;
					case 'float':
						if(in_array($field,array('int','boolean'))){
							 $app->enqueueMessage(JText::sprintf( 'WRONG_COLUMN_TYPE', $field));
							 $queryTables = '';
						}
						break;
					case 'string':
						if(!in_array($field,array('varchar','text','char'))){
							 $app->enqueueMessage(JText::sprintf( 'WRONG_COLUMN_TYPE', $field));
							 $queryTables = '';
						}
						break;
				}
			}
		}
		if($action['operation'] == 'int'){$value = (int)$action['value'];}
		elseif($action['operation'] == 'float'){$value = (float)$action['value'];}
		elseif($action['operation'] == 'string'){$value = $db->quote($action['value']);}
		elseif($action['operation'] == 'operation'){
			$strings = array();

			// Regex
			$symbols = array('%','+','-','/','*','(',')');
			$string = str_replace($symbols,'||',$action['value']);
			$entries = explode('||',$string);

			foreach($entries as $entry){
				$data = explode('.',$entry);
				if(!isset($data[1]) || (is_numeric($data[0]) && is_numeric($data[1])))
					continue;
				$strings[]['table'] = $data[0];
				$strings[]['column'] = $data[1];
			}

			$type = 'table';
			if(!empty($mainFields)){
				foreach($strings as $string){
					if(isset($string['table']) && $type == 'table'){
						if(!in_array($string['table'], $possibleTables)){
							$app->enqueueMessage(JText::sprintf('TABLE_NOT_EXIST',$string['table']));
							$queryTables = '';
							continue;
						}
						if(!in_array($string, $queryTables)){
							$queryTables[] = 'hk_'.$string;
						}
						$type = 'column';
					}elseif(isset($string['column']) && $type == 'column'){
						$colKey = array();
						foreach($mainFields as $key => $field){
							$colKey[] = $key;
						}
						if(!in_array($string['column'], $colKey)){
							$app->enqueueMessage(JText::sprintf('COLUMN_NOT_EXIST',$string['column']));
							$queryTables = '';
						}
						$type = 'table';
					}
				}
			}

			// if !number
			if(!preg_match('/^(?:\d+|\d*\.\d+)$/',$action['value'])){
				// if operation (ex: +5, -2) increment the value in the type selected table

				if(in_array($action['value'][0], array('+','-'))){
					$value = $action['type'].$action['value'];
				}
				// else add the prefix
				else{
					$value = $action['value'];
					// Group the available tables in only one entry
					$tables = array();
					foreach($strings as $string){
						if(isset($string['table'])){
							$tables[$string['table']] = $string['table'];
						}
					}
					// add the prefix
					foreach($tables as $table){
						$value = str_replace($table.'.','hk_'.$table.'.',$value);
					}
				}
				$value = strip_tags($value);
			}
			// default value
			else{
				$value = $db->quote($action['value']);
			}
		}else{$value = '';}
		return $value;
	}

ps: you have to use 1.25 instead of 1,25 (a dot instead a comma)

Last edit: 8 years 11 months ago by Xavier.

Please Log in or Create an account to join the conversation.

  • Posts: 27
  • Thank you received: 0
8 years 10 months ago #229075

Hello,

And what about updating the prices only in one currency but keep the other currencies unchanged?
I tried to do that with a filter on price_currency_id contains EUR for example but it doesn't work, it updates all prices anyway...

Many Thanks
Raphael

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
8 years 10 months ago #229214

Hi,

For now the filter only allow to get the products having prices in the selected currency.
But doesn't allow to apply the modification on that specific price.

This improvement is on our todo list.

What can be done is to use the "Display the results" action which will display a table with all the elements, and there you will be able to edit the price of the specific currency only.

Last edit: 8 years 10 months ago by Xavier.

Please Log in or Create an account to join the conversation.

Time to create page: 0.136 seconds
Powered by Kunena Forum