Forum
Editing slug on product
Hi
A client has edited the SKU and Product name in Shop/Products. Is there a way to edit the slug? As the old name is showing in search results at the moment. Also, the variants are being changed, but it still references the old name of the product when editing in Perch. For example;
Editing product variant ‘Old name showing’
Does the client need to re-create the variants again? Or is just changing the SKU of the variant and re-saving enough?
Diagnostics
Perch Runway: 3.0.10, PHP: 7.2.6, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $, with PDO
Server OS: Linux, fpm-fcgi
Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_blog (5.5.1), stotto_create_order (1), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2), pipit_catalog (1.1.0)
App runtimes: <?php $apps_list = array( 'perch_members', 'perch_shop', 'perch_blog', 'stotto_create_order', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/stotto/public_html/dev/perch
PERCH_CORE: /home/stotto/public_html/dev/perch/core
PERCH_RESFILEPATH: /home/stotto/public_html/dev/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 32M, Max POST 32M, Memory: 256M, Total max file upload: 32M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /home/stotto/public_html/dev
HTTP_HOST: dev.stotto.com
Hi Wayne
You can set the slug tag to be editable, but it rather depends on how you form the slug.
<perch:content id="slug" type="slug" for="heading" editable>
More here: https://docs.grabaperch.com/templates/field-types/slug/
The issue with allowing the client to do this is that your previous URL will now result in a 404. You'd need to have some kind of redirection in place to save the old URL and create a redirect. I haven't done this before, but I don't imagine it's too tricky.
Jon
Thanks Jon
I'll take a look. I don't think this will come up to often. Its only happened once and we're currently on the dev version, so I could enable editable slugs, then disable it before we launch.
Thanks again Wayne
Good luck! There's also a setting to allow it to be editable once at creation and then locked thereafter.
Thanks
I've added edible="true" to the slug tag in product.html in templates/shop/products/
<perch:shop id="slug" type="slug" editable="true" indelible="true" label="Slug" for="title sku" order="10" divider-before="Meta data" />
But the slug field is greyed out and I can't edit it. Have I done something wrong?
Regards Wayne
If the slug's already been created then
indelible="true"
will lock it after the first save. Best to re-save your template with just editable enabled. Then add the indelible parameter when you're done changing slugs.Of course. That sorted it... thank you.