Skip to main content

Mass action Update product value operations

More
11 years 7 months ago - 11 years 7 months ago #191314 by earmaster
-- 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




Last edit: 11 years 7 months ago by earmaster. Reason: Misleading title changed

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

More
11 years 7 months ago #191343 by Xavier
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:
Code:
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:
Code:
$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.

More
11 years 7 months ago #192202 by earmaster
Thanks! Worked flawlessly!

One thing tho

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


Looks like this for me:
Code:
$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.

More
11 years 7 months ago #192206 by Xavier
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.190 seconds
Powered by Kunena Forum