Forum

Thread tagged as: Problem, Runway, Shop

Custom product template won't show repeating region

Hi I'm trying to add the ability for additional images to be added to a product listing in shop.

I've tried adding a repeating region to my custom product.html template.

<perch:shop id="sku" type="text" label="SKU" required="true" order="1" />
<perch:shop id="title" type="text" label="Title" required="true" order="2" />
<perch:shop id="slug" type="slug" editable="true" indelible="true" label="Slug" for="title sku" order="10" divider-before="Meta data" />
<perch:shop id="description" type="textarea" label="Description" editor="markitup" order="3" markdown="true" size="s" />
<perch:shop id="image" type="image" label="Main product image" order="4" width="800" height="550" crop="true" bucket="tools" />
<perch:shop id="image" type="image" width="80" height="80" crop="true" />

<perch:repeater id="productImages" label="Images">
    <perch:template path="content/image.html">
</perch:repeater>

<perch:shop id="status" type="shop_status" label="Status" />

<perch:shop id="brand" type="shop_brand" label="Brand" allowempty="true" />

<perch:categories id="category" set="products" label="Category">
    <perch:category id="catTitle" />
</perch:categories>

I see the region title and 'Add an item' button on the page but when I add one the entry row is empty.

According to the debug message the template (/templates/content/image.html) is being referenced:

Debug Message - Perch Runway 3.1.1
[1] SELECT u.*, r.* FROM perch3_users u, perch3_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='eb6ee34897d8f7ad84676983fa76b4ad' LIMIT 1
UPDATE perch3_users SET userHash='618eb62b693add718bdf9f66a345e7bf' WHERE userID='1'
[42] SELECT settingID, settingValue, userID FROM perch3_settings WHERE userID=1 OR userID=0 ORDER BY userID ASC
[12] SELECT itemValue FROM perch3_menu_items WHERE itemType='app'
[1] SELECT * FROM perch3_shop_products WHERE productID='4' AND productDeleted IS NULL LIMIT 1
Using template: /templates/shop/products/product.html
Using sub-template: /templates/content/image.html
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 0, 1
[7] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=1 ORDER BY mi.itemOrder ASC
[1] SELECT itemTitle FROM perch3_menu_items WHERE itemType='app' AND itemValue='perch_shop_products' LIMIT 1
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 1, 10
[2] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=2 ORDER BY mi.itemOrder ASC
File: /addons/apps/perch_shop_products/modes/product.edit.post.php
[1] SELECT * FROM perch3_resources WHERE resourceID='68' LIMIT 1
[1] SELECT * FROM perch3_shop_brands WHERE 1=1 AND brandDeleted IS NULL ORDER BY brandTitle ASC
[nil] SELECT * FROM perch3_categories c, perch3_category_sets s WHERE c.setID=s.setID AND s.setSlug='products' ORDER BY catTreePosition ASC
[1] SELECT * FROM perch3_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch3_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[1] SELECT * FROM perch3_shop_currencies WHERE currencyActive=1 ORDER BY currencyID=47 DESC, currencyCode
[3] SELECT * FROM perch3_shop_tax_groups WHERE 1=1 AND groupDeleted IS NULL ORDER BY groupTitle ASC
Mode: product.edit
Queries: 18
Memory: 4.8096

I can add extra images by explicitly adding an entry for each one like:

<perch:shop id="image_1" type="image" label="image 1" width="800" height="550" bucket="custom" crop="true" />
<perch:shop id="image_2" type="image" label="image 1" width="800" height="550" bucket="custom" crop="true" />
<perch:shop id="image_3" type="image" label="image 1" width="800" height="550" bucket="custom" crop="true" />

Should adding a repeating region be possible?

Thanks

diagnostic

Perch Runway: 3.1.1, PHP: 7.2.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1), perch_blog (5.6.1), perch_forms (1.11), perch_shop_orders (1.2.6), perch_shop_products (1.2.6), perch_shop (1.2.6), perch_members (1.6.4)
App runtimes: <?php $apps_list = [ 'content', 'categories', 'perch_blog', 'perch_members', 'perch_shop', 'perch_forms' ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/xxx/Documents/MAMP-SERVERS/xxx.co.uk/perch
PERCH_CORE: /Users/xxx/Documents/MAMP-SERVERS/xxx.co.uk/perch/core
PERCH_RESFILEPATH: /Users/xxx/Documents/MAMP-SERVERS/xxx.co.uk/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 8M, Memory: 128M, Total max file upload: 8M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/grahams/Documents/MAMP-SERVERS/xxx.co.uk
HTTP_HOST: xxx.local
Graham Shedden

Graham Shedden 0 points

  • 2 years ago

I noticed after posting that my Runway version was out of date. Have updated to latest and also the forms add-on. Still the same issue.

new diagnostic

Perch Runway: 3.1.2, PHP: 7.2.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (3.1.2), assets (3.1.2), categories (3.1.2), perch_blog (5.6.1), perch_forms (1.12), perch_shop_orders (1.2.6), perch_shop_products (1.2.6), perch_shop (1.2.6), perch_members (1.6.4)
App runtimes: <?php $apps_list = [ 'content', 'categories', 'perch_blog', 'perch_members', 'perch_shop', 'perch_forms' ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /Users/xxx/Documents/MAMP-SERVERS/xxx.co.uk/perch
PERCH_CORE: /Users/xxx/Documents/MAMP-SERVERS/xxx.co.uk/perch/core
PERCH_RESFILEPATH: /Users/xxx/Documents/MAMP-SERVERS/xxx.co.uk/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 8M, Memory: 128M, Total max file upload: 8M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/xxx/Documents/MAMP-SERVERS/xxx.co.uk
HTTP_HOST: xxx.local
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Graham,

I assume you're using perch:content inside the repeaters.

In your template includes tag perch:template use rescope="parent" to be able to use the content namespace instead of shop.

Alternatively update your template to use perch:shop inside the repeaters.

Hi Hussein Thank you for the reply.

Yes you're right, adding rescope='parent' to the template include worked.

Thank you :-)