Jump to content

Resolved - Issue with Cloned Product Manufacturer


Dirty Butter

Recommended Posts

Twice today I cloned an existing product that DID have a manufacturer to create a product that did NOT have a known manufacturer. Everything worked as expected, except nothing I did would save the NONE as manufacturer. It continued to revert to the manufacturer from the cloned item. I had to go to phpMyAdmin to change the manufacturer code back to zero in the inventory table.

Could someone please test this in your store to see if this is a bug or not? If it is a bug, I wonder how far back it's been there...

Edited by Dirty Butter
Link to comment
Share on other sites

In the admin skin template products.index.php, near line 151, find:

       <select name="manufacturer" id="manufacturer" class="textbox" type="text">
          <option value="">{$LANG.form.none}</option>
          {foreach from=$MANUFACTURERS item=manufacturer}
          <option value="{$manufacturer.id}"{$manufacturer.selected}>{$manufacturer.name}</option>
          {/foreach}
       </select>

Change this line:

<option value="">{$LANG.form.none}</option>

To be like this:

<option value="0">{$LANG.form.none}</option>

The cause of the problem is that there is code to remove data from the product array being POSTed that has been shown to cause errors with certain database server configurations if that data is blank. (This was an issue since CC3 because CubeCart was never coded to work with a MySQL database configured for "strict" mode. Now, from since the latest versions of CC5, a command is sent to the database to force it out of strict mode.)

So, a test is made and these certain data elements are removed if they are blank, null, an empty array, etc, but will keep them if they are '0' or '0.0'.

So, the fix is to make the "--None--" choice of manufacturer be '0' and not blank. A manufacturer "id" of zero is a valid value to represent "no such related record in database'.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...