Jump to content

product code uncheck auto generate


Claudia M

Recommended Posts

How do I uncheck the automatically generate product code in admin/product/ general information. For some reason when I upgraded to 6.4.3 if I put in my own product code it does not take the first time and I have to go back in admin and reenter my product code. Thought it might have something to do with this being checked and I overlooked it.

Thanks in advance,

Claudia

Link to comment
Share on other sites

Your conclusion is correct.

Regarding the "Auto Generate Product Code" checkbox, CubeCart treats this as a priority, meaning, if checked, regardless if you enter a value in the text box, CubeCart will create a product code for you.

Contrary-wise, if the checkbox is unchecked, yet the text box is left empty, CubeCart will still create a product code for you.

(Note: When adding a new product, several things are set as default: status is checked, Auto Generate is checked, a suggested SEO path is created, selected to be Featured, selected to be in Latest Products, and selected to enforce stock levels.)

Are you not able to uncheck this checkbox?

Or do you want it initially unchecked when adding a new product? That can be done in the skin or the core code.

 

Link to comment
Share on other sites

Let's do it in the skin.

In the admin skin, products.index.php, find:

Near line 169:
<div><label for="product_code_auto">{$LANG.catalogue.product_code_auto}</label><span><input name="product_code_auto" id="product_code_auto" type="hidden" class="toggle" value="{$PRODUCT.auto_code_checked}"> <input name="product_code_old" id="product_code_old" type="hidden" value=""></span></div>

Change to:
<div><label for="product_code_auto">{$LANG.catalogue.product_code_auto}</label><span><input name="product_code_auto" id="product_code_auto" type="hidden" class="toggle" value="0{* $PRODUCT.auto_code_checked *}"> <input name="product_code_old" id="product_code_old" type="hidden" value=""></span></div>

Then, there is another change in the admin skin's admin.js file, find:

Near line 243:
    if($("input#product_code").length > 0) {
        $("input#product_code").val().length > 0 ? $("input#product_code_auto").val('0') : $("input#product_code_auto").val('1'); $("input#product_code_auto").change();
    }

Change to:
    if(false && $("input#product_code").length > 0) {
        $("input#product_code").val().length > 0 ? $("input#product_code_auto").val('0') : $("input#product_code_auto").val('1'); $("input#product_code_auto").change();
    }

The programmers really, really wanted to make sure that the product getting a code is super-duper idiot-proof.

Link to comment
Share on other sites

  • 1 year later...

Try this:

Undo any edit made to the admin skin (as detailed above).

Make this edit to the admin.js file (slightly different than the edit detailed above):

Near line 243, find:

if($("input#product_code").length > 0) {

Change to:

if(!1 && ($("input#product_code").length > 0)) {

In the file /admin/sources/products.index.inc.php:

Near line 1092, find:

$result[0]['auto_code_checked'] = (empty($result[0]['product_code'])) ? '1' : '0';

Change to:

$result[0]['auto_code_checked'] = '0'; // (empty($result[0]['product_code'])) ? '1' : '0';

However, you said, "For some reason when I upgraded to 6.4.3 if I put in my own product code it does not take the first time and I have to go back in admin and reenter my product code."

This may be fixed in CC646. When you start typing in the Product Code text entry field, the Auto checkbox gets unchecked.

Edited by bsmither
Link to comment
Share on other sites

You may need to force your browser to fetch a fresh copy of admin.js file. Your browser could be using a cached copy. Re-fetching cached page resources is usually done by CTRL-F5.

I hope you caught the edit to my previous response. CC646 has made it so that once you begin entering a product code, the checkbox will get unchecked.

Oh, and clear CubeCart's internal cache.

Edited by bsmither
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...