Mass action Update product value operations

  • Posts: 132
  • Thank you received: 2
9 years 9 months ago #191314

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.3.10
-- Error-message(debug-mod must be tuned on) -- : The table product does not exist

The table product_alias does not exist

Successfully Saved

Hi!

I'm fiddling with the Mass actions and because of how our shop is setup I need to change the products canonial URL after they are made, I intend to do this with Mass action as it can trigger after product creation.

Now the issue is that I can't get it to function as I want, I want to create the canonial url as such:

/shop/products/product-alias-here

I have tried numerous ways but I cannot figure out how. pictures below are just some of my numerous attempts





Attachments:
Last edit: 9 years 9 months ago by earmaster. Reason: Misleading title changed

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

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

Hi,

This is not yet possible in the mass actions, but I add that on our TODO list.
For the moment, you could potentially edit the file "plugins/hikashop/massaction_product/massaction_product.php" and add:

if(preg_match_all('#{(.*)}#U',$value,$matches)){
	foreach($elements as $k => $element){
		foreach($matches[0] as $match){
			$var = str_replace(array('{','}'),'',$match);
			$value = preg_replace('#'.$match.'#',$element->$var,$value);
		}
	}
}
Juste after:
$value = $this->massaction->updateValuesSecure($action,$elements,$possibleTables,$queryTables);

And use the following syntax:

product_canonical = STRING /shop/product/{product_alias}

The following user(s) said Thank You: earmaster

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

  • Posts: 132
  • Thank you received: 2
9 years 8 months ago #192202

Thanks! Worked flawlessly!

One thing tho

$value = $this->massaction->updateValuesSecure($action,$elements,$possibleTables,$queryTables);


Looks like this for me:
$value = $this->massaction->updateValuesSecure($action,$possibleTables,$queryTables);

It still works by placing the code below it, just though I should mention that those two lines didn't match.

(Sorry for the late reply).

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

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #192206

Hi,

Yes it's normal, I added some changes in the code on my end for testing purposes, you code is correct.

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

Time to create page: 0.070 seconds
Powered by Kunena Forum