How to use Mass action to update products' canonical url

  • Posts: 124
  • Thank you received: 6
3 months 3 weeks ago #362870

Hi
How to use Mass action to update products' canonical url?
I want the canonical link to be something like: categoryName/product_alias
You wrote in the documentation that operations can be used.
Is it true as I wrote?

Attachments:

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

  • Posts: 124
  • Thank you received: 6
3 months 3 weeks ago #362871

I used CONCAT('printes/', '{product_alias}') but the result was printes/{product_alias}.

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
3 months 3 weeks ago #362876

Hi,

You can find the mass action documentation page here:
www.hikashop.com/support/documentation/167-massaction-form.html
There, we have a section for the "update the values" action:

When using the "Update the values" action, you have several modes:
INT For which you can provide a number without decimals
FLOAT For which you can provide a number with decimals
STRING For which you can provide a text
OPERATION In that case, you can provide a formula with arithmetic operations (if you're processing numbers), or text operations (if you're processing text). You can also use tags like product.product_name or price.price_value or order.order_full_price or user.user_email, etc in your operations. These tags must match with the column names in the database for the corresponding tables. For arithmetic operations, you can use the MySQL numeric functions, and for text operations, you can use MySQL string operations. This can allow you to update product prices, generate the canonical URL from the alias of the product, update stocks, automatically fill custom fields, etc.

As per this documentation, the tag you want to use is product.product_alias

So, in your case, it should be:
CONCAT('printes/', product.product_alias)

The following user(s) said Thank You: levelup

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

  • Posts: 124
  • Thank you received: 6
3 months 3 weeks ago #362886

Hi
I did this, but it gives a message: the product table does not exist
I even tested with CONCAT('printes/', hikashop_product.product_alias) and CONCAT('printes/', jjs3u_hikashop_product.product_alias), but it still gives the same message.

Last edit: 3 months 3 weeks ago by levelup.

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
3 months 3 weeks ago #362900

Hi,

If you have the error message "the product table does not exist" with the operation "CONCAT('printes/', product.product_alias)" it means that the type of the mass action is not "product".
For example, for category mass actions, you can't use an operation on product.product_alias. However, you can use an operation on category.category_alias.
It's also not possible to use full table names. We only allow a restricted number of values for security reasons.

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

  • Posts: 124
  • Thank you received: 6
3 months 3 weeks ago #362929

As it is clear from the picture inserted in the #362870 message, the type of Mass Action is the Product.

Last edit: 3 months 3 weeks ago by levelup.

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

  • Posts: 4763
  • Thank you received: 647
  • MODERATOR
3 months 3 weeks ago #362930

Hello,

Can you provide a new screenshot of your MassAction with the error message?
There is something strange in your issue.

Regards

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

  • Posts: 124
  • Thank you received: 6
3 months 2 weeks ago #362964

Hi
As an experiment, I want to apply it to a product for now.
If it works, I'll set up for all a category products.

Attachments:

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
3 months 2 weeks ago #362966

Hi,

Can you change the operation to "CONCAT('printes/', product.product_alias)" and run it ? What error do you get ?
Please make sure you remove the { and }. This is not valid and it won't work. That's why you get the error "the table {product does not exist" because the system is looking for the table {product instead of the table product.

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

  • Posts: 124
  • Thank you received: 6
3 months 2 weeks ago #362989

It still gives the same error message:
The table product does not exist.

Attachments:

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
3 months 2 weeks ago #362995

Hi,

Can you try with this instead then:

CONCAT('printes/',product.product_alias)
(without the space between the comma and the product)

The following user(s) said Thank You: levelup

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

  • Posts: 124
  • Thank you received: 6
3 months 2 weeks ago #363050

This worked. thank you.

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

Time to create page: 0.080 seconds
Powered by Kunena Forum