Jump to content

Repeaterfield on product template


Recommended Posts

Hi @kongondo,

I have a repeaterfield on my product template. When I enable product variants the JS for InputfieldRepeater will trigger based on 'InputfieldRepeaterItem' class, causing errors and the variant's content gets hidden.

InputfieldPadloperRuntimeMarkup.module

// @note @kongondo: we need this class 'InputfieldRepeaterItem' so InputfieldImage.js will read the ajax postUrl from our data-editUrl here
$wrap->addClass('InputfieldPadloperRuntimeMarkupItem InputfieldNoFocus InputfieldRepeaterItem');

You have any ideas to prevent this? (I'd rather not change Fieldtype Repeater module itself, which I have done in the meanwhile)

  • Like 1
Link to comment
Share on other sites

Hi @Spinbox,

This has been reported before but I have never found a solution.

On 8/5/2024 at 2:53 PM, Spinbox said:

InputfieldPadloperRuntimeMarkup.module

This is a runtime field used by Padloper in various places to embed editable content from other sources in the current page edit. E.g. in the case of products, to load variants. 

Without  'InputfieldRepeaterItem' class uploading variant images does not work, i.e. they show up but do not get saved and just disappear. I'll ask Ryan for his thoughts.

  • Like 1
Link to comment
Share on other sites

  • 11 months later...

Hi @kongondo,

I am replying here (but will also do in github for coherence), but thanks to the deepwiki I might have found a simple fix while trying to add repeaters do enhance products on frontend and ended up seeing this same issue.

There would be something simple to add into InputfieldPWCommerceRuntimeMarkup.module:

// in protected function buildForm($pages, $isNew = false, $cnt = 0)
// around line 486

// replace the original $wrap->addClass('InputfieldPWCommerceRuntimeMarkupItem.... 

// $wrap->addClass('InputfieldPWCommerceRuntimeMarkupItem InputfieldNoFocus InputfieldRepeaterItem');
$classes = 'InputfieldPWCommerceRuntimeMarkupItem InputfieldNoFocus';  
// Only add InputfieldRepeaterItem if no actual repeater fields exist on template  
if (!$this->templateHasRepeaterFields()) {  
    $classes .= ' InputfieldRepeaterItem';  
}  
$wrap->addClass($classes);

Helper:

// around line 1190

private function templateHasRepeaterFields() {  
    $template = $this->page->template;  
    foreach($template->fieldgroup as $field) {  
        if($field->type instanceof FieldtypeRepeater) {  
            return true;  
        }  
    }  
    return false;  
}

Hope it helps!

  • Like 1
Link to comment
Share on other sites

8 hours ago, marie.mdna said:

I am replying here (but will also do in github for coherence), but thanks to the deepwiki I might have found a simple fix while trying to add repeaters do enhance products on frontend and ended up seeing this same issue.

Hi @marie.mdna,

Nice! Thanks for the suggested fix. Did you test with uploading images to product variants? Do they save OK? That has always been the issue.

Thanks.

Link to comment
Share on other sites

On 7/16/2025 at 11:19 PM, kongondo said:

Did you test with uploading images to product variants? Do they save OK? That has always been the issue.

@kongondo Yes! 🙂 I've added/removed/edited images within the variants and it all seems to save perfectly!

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...