combo box image - fromSelect with Miva Shopping Cart

Previously posted: dhtmlx.com/docs/products/kb/inde … 706&a=6875

I have referenced the aforementioned question and applied the recommended answer to no avail. Everything seems to work ok, except that no images appear in the combo box. Any suggestions?

Here is my code:

        
            <mvt:foreach iterator=“option” array=“attribute:options”>
               <mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR
                                        ( g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code )">
                  &mvte:option:prompt;
               mvt:else
                  &mvte:option:prompt;
               </mvt:if>
            </mvt:foreach>



Hello,


please, check that dhtmlxcombo_extra.js is included and paths to images are correct.

Thanks… that partially worked, I now see the images. The path was correct I was missing the dhtmlxcombo_extra.js file.

Now two new issues have occurred. I have searched the Knowledge Base with no luck trying to solve it myself.

1. The dhtmlXComboFromSelect does not pass the option when I press the Add button. I’ve tried several modifications unsuccessfully.

2. How do I specify the setDefaultImage with dhtmlXComboFromSelect. - I’ve also had no luck with this.

Your advice is greatly appreciated.



>> The dhtmlXComboFromSelect does not pass the option when I press the Add button. I’ve tried several modifications unsuccessfully.


Please, explain what code Add button executes.


>> How do I specify the setDefaultImage with dhtmlXComboFromSelect. - I’ve also had no luck with this.


setDefaultImage method can be used as follows:


var combo =dhtmlXComboFromSelect(“select_id”);
combo.setDefaultImage(…)


But it won’t have effect on options that are set in the select element - only for the new options that are added after initialization.






Please, explain what code Add button executes.



 Thank you for all your


So… how does this line relate to combo ? Please provide more details about the issue

The combo box is for attributes/options that are passed for a product being added to a shopping cart.

This combo box does not pass the attributes when I add the item using var z=dhtmlXComboFromSelect(“combo_zone1”);, although it does add the item.

This is the entire options code:


   <mvt:foreach iterator=“attribute” array=“attributes”>
  
      <mvt:if expr =“l.settings:attribute:template_code NE 0”>
        
      </mvt:if>
   <mvt:if expr = “l.settings:attribute:type EQ ‘checkbox’”>
  
  
  
  
      mvt:else
  
  
   <mvt:if expr=“l.settings:attribute:type EQ ‘text’”>
  
   <mvt:elseif expr=“l.settings:attribute:type EQ ‘memo’”>
  
   <mvt:elseif expr=“l.settings:attribute:type EQ ‘radio’”>
  
   <mvt:elseif expr=“l.settings:attribute:type EQ ‘select’”>
  
      </mvt:if>
  
      </mvt:if>
   </mvt:foreach>
  

       
  

   <mvt:item name=“fonts” param=“body_font”>
      <mvt:if expr = “g.Product_Attributes[l.settings:attribute:index]:value”>
        
      mvt:else
        
      </mvt:if>
      <mvt:if expr=“l.settings:attribute:image”>
         &mvte:attribute:prompt;
      mvt:else
         <mvt:if expr=“l.settings:attribute:required”>
            &mvt:attribute:prompt;
         mvt:else
            &mvt:attribute:prompt;
         </mvt:if>
      </mvt:if>
      </mvt:item>
  

   <mvt:item name=“fonts” param=“body_font”>
      <mvt:if expr=“l.settings:attribute:image”>
         &mvte:attribute:prompt;
      mvt:else
         <mvt:if expr=“l.settings:attribute:required”>
            &mvt:attribute:prompt;
         mvt:else
            &mvt:attribute:prompt;
         </mvt:if>
      </mvt:if>
      </mvt:item>
  

      <mvt:item name=“fonts” param=“body_font”>
        
      </mvt:item>
  

      <mvt:item name=“fonts” param=“body_font”>
         &mvte:attribute:value;
      </mvt:item>
  

     
         <mvt:foreach iterator=“option” array=“attribute:options”>
        
        
        
        
         </mvt:foreach>
     

            <mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR
                        ( g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code )">
              
            mvt:else
              
            </mvt:if>
        

            <mvt:if expr=“l.settings:option:image”>
               &mvte:option:prompt;
            mvt:else
               <mvt:item name=“fonts” param=“body_font”>
                  &mvte:option:prompt;
               </mvt:item>
            </mvt:if>
        

  

      <mvt:item name=“fonts” param=“body_font”>
     
         <mvt:foreach iterator=“option” array=“attribute:options”>
            <mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR
                ( g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code )">
               &mvte:option:prompt;
            mvt:else
               &mvte:option:prompt;
            </mvt:if>
         </mvt:foreach>



 
   </mvt:item>
  



the latest combo version allows to define img_src and value attributes in case of initialization using select - the sample is attached.


But there is the issue in your code. You call dhtmlXComboFromSelect method twice.


1247822593.zip (19.9 KB)

I am new with scripting and editing code. I was not aware that I was to replace var z with var combo I have fixed the duplicate entry and have also uploaded the files you included.

Modified Code:
     
         <mvt:foreach iterator=“option” array=“attribute:options”>
            <mvt:if expr="( ( g.Product_Attributes[l.settings:attribute:index]:value EQ 0 ) AND ( l.settings:option:id EQ l.settings:attribute:default_id ) ) OR
                ( g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code )">
               &mvte:option:prompt;
            mvt:else
               &mvte:option:prompt;
            </mvt:if>
         </mvt:foreach>


However, I am still not getting the option to pass when I press the Add button, which submits the product to the shopping cart. I believe the value is supposed to get passed by: value="&mvte:option:code;", which is not. The product gets added but the option does not.

I’ve tried using this as well. var z=dhtmlXComboFromSelect(“combo_zone1”, “&mvte:option:code;”,200);

Here is the link to where I am trying to use the code: store.glittergaloreandmore.com/G … itter.html.

Since the modification does not work. I have commented out the code.

I want to make sure I explain myself correctly. I want to use dhtmlxcombo and  place images for various products where I use a select combo box. I want one option per select combo box. However, some products may have multiple select combo boxes.

Here is a link for a one select combo box product: store.glittergaloreandmore.com/6 … ction.html

My goal is to add the dhtmlxcombo feature to every product where I currently use a select box (l.settings:attribute:type EQ 'select), as noted on the pasted code on the  previous post.

When I attempt to use dhtmlxcombo as described the product gets added but not the option. I do not know hot to pass that value with Miva Merchant.

I hope that by providing the links you get a better grasp of what I am trying to do.

Thanks in advance…jr


Hello,


the links that you have provided don’t use dhtmlxcombo: the code of combo initialization is commented here.


This code is correct. But you didn’t set path to images - I haven found empty img_src attribute.






Hi Alex,

The images do work. The paths are created dynamically with img_src="&mvte:option:image;", depending on the product.

I only want to use the dhtmlx Combo box when I use the “select type.”, which is why you don’t see it for the other types in the code.

The reason that I have commented the code is because it doesn’t work and the website is in production mode. When I use the code the clients cannot add the product options when they add the product. I have to make sure that it is working before I apply the dhtmlxcombo script permanently.

Is there any way that we can coordinate so I can apply the script and you can see what is happening. I can do it at a predetermined time, or if you have any other suggestions, I would gladly consider them.

I am in Phoenix, Arizona time zone. I look foward to your comments.


Hello,


you can provide the sample, where we can reproduce the issue, or direct link to the page to support@dhtmlx.com

Thank you for giving me the idea to create a duplicate test template so you could see it first hand.

Here is the link: store.glittergaloreandmore.com/m … Stars_Jars.

So far I have only added the icon images to this product.

I look forward to your response.

I forgot to mention that when you add the product after selecting a color star, click on the shopping bag to see the item. The color is not passed. This is what I am trying to fix


Hello,


the issue is caused by incorrect select name Product_Attributes[1]:value. It is defined as array.


Try to replace it with the new name - and the issue will be solved (for example prod_color or something else).

the issue is caused by incorrect select name Product_Attributes[1]:value. It is defined as array.

This works fine as is. It stops working when I try to use the script.  Here is the link to the original template (code) without the script:  store.glittergaloreandmore.com/m … Stars_Jars

To access the test template, modify the part of the URL from Screen=PROD to Screen=PRD2. This is the template that I am using now to test the script.
 
I am not sure how to replace the array with a new name without causing the other select types or other functions not to work. Everything works fine as is. I want to add the dhtmlxcombo feature as seamlessly as possible without modifying the original code to much and wrecking something else in the process.

Is there any other way to pass the attribute?


The combo creates 2 hidden elements. 1 one has the same name as select and the 2nd select name + “new_value”. So, the issue is caused by Product_Attributes[1] _new_value element name.


You can change the element name manually:


var combo =dhtmlXComboFromSelect(“combo_zone1”);
combo.DOMelem_hidden_input2.name = “Product_Attributes_new_value[1]”;



I really appreciate your help. My understanding of this type of programing is really minimal. I am not sure how to even test what I try .

I tried your suggestions of adding the combo.DOMelem_hidden_input2.name but this works on the second and subsequent products I add. It doesn’t add the option for the fist product.

Please, take a look at the sample dhtmlx.com/docs/products/dhtmlxC … _save.html. Possibly it’ll help for better understanding