Jump to content

Edit History

kuch

kuch

Hello,

I have several products in the store, classic template. Each of them has several combinations based on the color attribute.

I added an additional value for the color attribute - "Custom Color" and for the product in the Options tab I added a field in Customization. There is a field next to the product to be filled in by the customer.

 

The idea is to show this field only if the customer has selected a "Custom color" from the color list.

 

In the /themes/classic/templates/catalog/_partials/product-customization.tpl file I added:

Instead
{if! $ configuration.is_catalog}

I added
{if! $ configuration.is_catalog && $ product.attributes[1].id_attribute == 33}

33 is the id of my "Custom Color" in the attributes.

 

Now when you click the custom color, the product combination switches and the customization box appears. Similarly, after changing to a different color, the field disappears.

I could leave it like that and in total it would fulfill the function but it is known that customers are extremely smart and problems may arise, e.g.

1. After selecting "custom color", the customization box appears. The customer enters there what color he would like. Saves the customization. Switches to a different combination (color). The customization field disappears but still has the customer value assigned. After adding to the basket, one of the standard colors will appear, but with a description that should be only with the custom one.

Can I somehow force this customization field to be cleared after switching to another product combination?

 

2. I would like to select the option that this customization field should be required, but when I do it, it becomes required for the entire product, so also other combinations (with no customization field visible). The product cannot be added to the cart because it is waiting for the adjustment value.

Is there any trick that the customization field is required only for the selected attribute / combination?

kuch

kuch

Hello,

I have several products in the store, classic template. Each of them has several combinations based on the color attribute.

I added an additional value for the color attribute - "Custom Color" and for the product in the Options tab I added a field in Customization. There is a field next to the product to be filled in by the customer.

 

The idea is to show this field only if the customer has selected a "Custom color" from the color list.

 

In the /themes/classic/templates/catalog/_partials/product-customization.tpl file I added:

Instead
{if! $ configuration.is_catalog}

I added
{if! $ configuration.is_catalog && $ product.attributes[1].id_attribute == 33}

33 is the id of my "Custom Color" in the attributes.

 

Now when you click the custom color, the product combination switches and the customization box appears. Similarly, after changing to a different color, the field disappears.

I could leave it like that and in total it would fulfill the function but it is known that customers are extremely smart and problems may arise, e.g.

1. After selecting "custom color", the customization box appears. The customer enters there what color he would like. Saves the customization. Switches to a different combination (color). The customization field disappears but still has the customer value assigned. After adding to the basket, one of the standard colors will appear, but with a description that should be only with the custom one.

Can you somehow force this customization field to be cleared after switching to another product combination?

 

2. I would like to select the option that this customization field should be required, but when I do it, it becomes required for the entire product, so also other combinations (with no customization field visible). The product cannot be added to the cart because it is waiting for the adjustment value.

Can any condition be made that the customization field is required only for the selected attribute / combination?

×
×
  • Create New...