Jump to content

Problem with product combinations


ianditch

Recommended Posts

I'm really struggling with this!

When i add a combination then this shows as it should on the product page. However, if i then add a second combination then this does not show and only the 1st combination is displayed.

No matter what i do, i cant display the 2nd combination and deleting the 1st combo will then show the 2nd but not both together. I hope that makes sense?

 

Is this something i'm doing wrong? I originally thought this was due to a template issue (im using the ps_apparel theme) but the default theme is doing the same and not showing the 2nd combo.

Also, I can see the 1st combo group in the page source but not the 2nd combo group.

Can anybody cast any light on this for me?

 

Ian

prestashop-combos.png

prestashop-combos2.png

Link to comment
Share on other sites

Right,

I need to sort this so i've been trying to work out how prestashop is coded.

The section which show the combindations in the product page is;

<div class="product-variants">
  {foreach from=$groups key=id_attribute_group item=group}
    {if !empty($group.attributes)}
    <div class="clearfix product-variants-item">
      <span class="control-label">{$group.name}</span>
      {if $group.group_type == 'select'}
      <select
          class="form-control form-control-select"
          id="group_{$id_attribute_group}"
          data-product-attribute="{$id_attribute_group}"
          name="group[{$id_attribute_group}]">
          {foreach from=$group.attributes key=id_attribute item=group_attribute}
            <option value="{$id_attribute}" title="{$group_attribute.name}"{if $group_attribute.selected} selected="selected"{/if}>{$group_attribute.name}</option>
          {/foreach}
        </select>


{$id_attribute_group}


    {elseif $group.group_type == 'color'}
        <ul id="group_{$id_attribute_group}">
          {foreach from=$group.attributes key=id_attribute item=group_attribute}
            <li class="float-xs-left input-container">
              <label>
                <input class="input-color" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
                <span
                  {if $group_attribute.html_color_code}class="color" style="background-color: {$group_attribute.html_color_code}" {/if}
                  {if $group_attribute.texture}class="color texture" style="background-image: url({$group_attribute.texture})" {/if}
                ><span class="sr-only">{$group_attribute.name}</span></span>
              </label>
            </li>
          {/foreach}
        </ul>
      {elseif $group.group_type == 'radio'}
        <ul id="group_{$id_attribute_group}">
          {foreach from=$group.attributes key=id_attribute item=group_attribute}
            <li class="input-container float-xs-left">
              <label>
                <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if}>
                <span class="radio-label">{$group_attribute.name}</span>
              </label>
            </li>
          {/foreach}
        </ul>
      {/if}
    </div>
    {/if}
  {/foreach}
</div>

I've added {$id_attribute_group} after the </select> for the {if $group.group_type == 'select'} within the foreach loop.

I should be seeing two id's here. id[1] and id[5] but i am only seeing id[1] so this to me is saying that there is only one key here and not the 2 keys as i am expecting? Am i right in thinking this?

 

Any help would be appreciated.

 

Ian

Link to comment
Share on other sites

Thanks musicmater,

 

It looks like i have the 2 combinations but only the values for one.

 

Array([1] => Array([group_name] => Enclosure[name] => Enclosure[group_type] => select[default] => 1[attributes] => Array([1] => Array([name] => Slim Enclosure[html_color_code] => [texture] => [selected] => 1)[2] => Array([name] => Deep Enclosure[html_color_code] => [texture] => [selected] => ))[attributes_quantity] => Array([1] => 10[2] => 10))[2] => Array([group_name] => CC Power Supply[name] => Power Supply[group_type] => select[default] => -1[attributes] => Array()[attributes_quantity] => Array()))

 

I's going to waste too much time with this and might just delete and re-install prestashop.

Link to comment
Share on other sites

So,

I've deleted my original installation and reinstalled.

I've not added any additonal themes or altered any settings but the combinations are exactly the same on the new install with the default theme???

 

The theme is showing in 2 columns as shown in the picture. Is this correct?

 

 

prestashop1.png

Link to comment
Share on other sites

On 2/17/2021 at 9:17 PM, ianditch said:

Thanks musicmaker but there are attributes in the power supply group.

If i delete the 1st group (enclosure) then the power supply group shows and works as it should. I cant add any more than one group ;-(

I'm losing the will to live with this now.

It may be that the file that I mentioned is overruled by an override. Check for that.

  • Like 1
Link to comment
Share on other sites

Thanks for your help musicmaster.

I did finally suss this in the end.... You HAVE to add all combinations in 'one shot'. I was adding my enclosure type and then adding my power supply type and generating each time. This does not work and gives the effect as i have detailed above on the front store.

If you select all required options and then hit generate it works.

  • Like 1
Link to comment
Share on other sites

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
×
×
  • Create New...