Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / UPC For Zencart Delivered

UPC For Zencart Delivered

Locked

Views: 10,764

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
25 May 2007, 7:17 PM
#1
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

UPC For Zencart Delivered

I'm not really sure if this is what you guys were looking for, but my company needed it so why not make my own :lookaroun? So i've done just that, this adds the UPC field to the product_type named product (the generic one). How I went about this was with alot of grep and vi :wacko:. I also tried to model the UPC around the model field, as they are relatively close to the same thing. Ok without any further deliberation I shall now unveil the UPC field:

MySQL (Zencart DB)
    PRODUCT_TYPES
        here lies the product types (templates)
    PRODUCT_TYPE_LAYOUT
        this is for configuration of fields
    GET_TERMS_TO_FILTER
        only useful for side box selection

PRODUCT_TYPES
    Not useful for adding UPC to Product-General

PRODUCT_TYPE_LAYOUT
    add new row
    INSERT INTO product_type_layout(configuration_title, configuration_key, configuration_value, configuration_description, product_type_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('Show UPC Number', 'SHOW_PRODUCT_INFO_UPC', 1, 'Display Model Number on Product Info 0=off 1=on', 1, 10, now(), now(), NULL, "zen_cfg_select_drop_down(array(array('id'=>'1', 'text'=>'True'), array('id'=>'0', 'text'=>'False')), ");

PRODUCTS
    add new field
    ALTER TABLE products ADD products_upc VARCHAR(12) DEFAULT(NULL);

./zencart/admin/includes/modules/product
    this has governing scripts over the general product type
    collect_info.php
        * add products_upc => '' to $parameters associative array
        * add p.products_upc to database query on line 60 apprx.
        */ add the following to the collection form
            <tr>
                <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
            </tr>
            <tr>
                <td class="main"><?php echo TEXT_PRODUCTS_UPC; ?></td>
                <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_upc', $pInfo->products_upc, zen_set_field_length(TABLE_PRODUCTS, 'products_upc')); ?></td>
            </tr>
        /*
    collect_info_metatags.php
        * add products_upc => '' to the $parameters associative array
        * add p.products_upc to the SQL query on line 34 apprx
        * add p.products_upc to the SQL query on line 42 apprx
        */ add to line 148 apprx
            '   <strong>' . TEXT_PRODUCTS_UPC . '</strong> ' . $pInfo->products_upc
        /*
    preview_info.php
        * add p.products_upc to SQL query on line 18 apprx
    preview_info_meta_tags.php
        * add p.products_upc to SQL query on line 18 apprx
        */ add to line 59 apprx
            <td class="main" valign="top">
               <?php echo '<strong>' . TEXT_PRODUCTS_UPC . '</strong> ' . ($pInfo->metatags_upc_status == '1' ? $pInfo->products_upc : TEXT_META_EXCLUDED); ?>
            </td>
        */
./zencart/admin/includes/modules/
    update_product.php
        * add products_upc => zen_db_prepare_input($_POST['products_upc']) to $sql_data_array associative array at line 33 apprx
    copy_to_confirm.php
        * add products_upc to the SQL query on line 35 apprx
        * add products_upc to the SQL query on line 53 apprx
        * add '" . zen_db_input($product->fields['products_upc']) . "', to line 65 apprx
    category_product_listing.php
        */ add to line 214 apprx
            case (7):
                $order_by = " order by p.products_upc DESC, pd.products_upc";
        /*
        * add p.products_upc to line 245 apprx
        * add p.products_upc to line 266 apprx
        */ add to line 332 apprx
            <td class="dataTableContent"><?php echo $products->fields['products_upc']; ?></td>
        /*
./zencart/includes/modules/pages/product_info/
    main_template_vars.php
        * add p.products_upc to line 56 apprx
        * add $products_upc = $product_info->fields['products_upc']; to line 102 apprx
        */ add to line 168 apprx
            $flag_show_product_info_upc = zen_get_show_product_switch($_GET['products_id'], 'upc');
        /*
./zencart/includes/templates/template_default/templates/
    tpl_product_info_display.php
        */ add to line 123
            <?php echo (($flag_show_product_info_upc == 1 and !empty($products_upc)) ? '<li>' . TEXT_PRODUCT_UPC . $products_upc . '</li>' : '') . "\n"; ?>
        /*
./zencart/includes/modules/pages/advanced_search_result/
    header_php.php
        To line 136 apprx 'PRODUCT_LIST_UPC' => PRODUCT_LIST_UPC,
        */ line 167 apprx
case 'PRODUCT_LIST_UPC':
    $select_column_list .= 'p.products_model';
break;
        /*
        */ line 302 apprx
LIKE '%:keywords%'
OR p.products_upc
        /*
        */ line 423 apprx
case 'PRODUCT_LIST_UPC':
    $order_str .= "p.products_upc " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_upc";
break;
        /*
./zencart/includes/index_filters/
    default_filter.php
        */ Line 116 apprx
case 'PRODUCT_LIST_UPC':
    $listing_sql .= "p.products_upc " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_upc";
break;
        /*
./zencart/includes/modules/pages/index/
    main_template_vars.php
        */ line 163 apprx
case 'PRODUCT_LIST_UPC':
    $select_column_list .= 'p.products_upc, ';
break;
        /*
./zencart/includes/modules/
    product_listing.php
        */ line 95 apprx
case 'PRODUCT_LIST_UPC':
    $lc_align = '';
    $lc_text = $listing->fields['products_upc'];
break;
        /*
```This should be enough to get the UPC field nice and presentable, it can be entered in admin interface, viewed in preview, viewed by customer, and is searchable as well. If there is any request for it (I may do it anyway) I shall make a product type maker, cause I may end up having to make one for my job anyway. I can also make a script for this if anyone asks.

Thanks for reading and any contributions or ideas of things I may have done wrong will be much apprciated,
        --Axpen
25 May 2007, 9:24 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: UPC For Zencart Delivered

I am positive that this would be of value to many on the forum...

Was this a modification to the "Products General" type?

Zen-Venom Get Bitten

25 May 2007, 9:34 PM
#3
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

Re: UPC For Zencart Delivered

Yes I modified the product general type

2 Jul 2007, 8:07 PM
#4
pastgentoys avatar

pastgentoys

Zen Follower

Join Date:
Jun 2007
Posts:
169
Plugin Contributions:
0

Re: UPC For Zencart Delivered

This looks exactly like what I need! Can you tell me the file path and file name I need to use? Thanks!

4 Jul 2007, 2:12 AM
#5
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

Re: UPC For Zencart Delivered

That code snippet isn't just for one file it's a combination of multiple files and even some SQL code to ALTER your database fields. It's not too structured for ease of readability, when I did this I was writing as I worked, so it's not too pretty. I'll post again by the end of this week with a more exhaustive and better looking tutorial/walk-through for you and others. I would just make a script or module but I have yet to grasp a good link for help making a module for Zen Cart. So until such a time I will work on this tutorial. Thank you for your interest in my addition and I look forward to assisting you in this matter.

--Alex

4 Jul 2007, 2:28 AM
#6
pastgentoys avatar

pastgentoys

Zen Follower

Join Date:
Jun 2007
Posts:
169
Plugin Contributions:
0

Re: UPC For Zencart Delivered

Great! I look forward to using your work!:clap:

7 Jul 2007, 9:42 PM
#7
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

Re: UPC For Zencart Delivered

I am working on a little tutorial right now, I got caught up in some road blocks like leaving my howtos at my job, but I should have that tutorial up by late sunday-early next week. I apologize for the delay, just letting you know I didn't forget about you :P.

8 Jul 2007, 12:54 AM
#8
pastgentoys avatar

pastgentoys

Zen Follower

Join Date:
Jun 2007
Posts:
169
Plugin Contributions:
0

Re: UPC For Zencart Delivered

axpen:

I am working on a little tutorial right now, I got caught up in some road blocks like leaving my howtos at my job, but I should have that tutorial up by late sunday-early next week. I apologize for the delay, just letting you know I didn't forget about you :P.

Thanks for the follow up - Mucho appreciado!

16 Jul 2007, 5:34 PM
#9
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

Re: UPC For Zencart Delivered

Ok sorry again about the wait, i've decided not to post about how to do it, rather make a module for you. I figured that would be best and easiest, and thusly is what is taking longer. I will have the module up later this evening. I will however warn you that since Zencart hasn't implemented admin overrides the would be trivial task of uploading files to the CUSTOM directory will instead be covered by other means. As I have detailed instructions in my README file I shan't delve into the details here, but I will be replacing my first post with a better formated text of my README.

Again thank you for your interest in my efforts, you can also expect an invoice module and POS module from me over the course of the next few months.

--Alex

28 Jul 2007, 8:21 AM
#10
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

Re: UPC For Zencart Delivered

Alright, I apologize for the delay of posting, I got tied up at work a bit. But without further adeiu I have the finished module. After getting approval and fix ups from some other members I shall then release it under the Zencart modules.

Thanks for your patience,
--Alex

7 Jan 2009, 3:04 AM
#11
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

Re: UPC For Zencart Delivered

My Addon has fallen out of favor due to size restrictions in uploading. I'm still around but feel that people drawn to this page should use the addon by Numinix as it already sufficiently does what mine does and rather than repackage mine to an addon I will redirect people to this one.

Please go to; http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=651 and download that for your UPC and ISBN needs.

Thanks for your interest in my solution and your time,
-Alex

9 Jan 2009, 7:45 PM
#12
litesprof avatar

litesprof

New Zenner

Join Date:
Oct 2007
Posts:
16
Plugin Contributions:
0

Re: UPC For Zencart Delivered

axpen:

My Addon has fallen out of favor due to size restrictions in uploading. I'm still around but feel that people drawn to this page should use the addon by Numinix as it already sufficiently does what mine does and rather than repackage mine to an addon I will redirect people to this one.

Please go to; http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=651 and download that for your UPC and ISBN needs.

Thanks for your interest in my solution and your time,
-Alex

I already added that mod to zen cart. The problem is i need to upload all of the upc code using easy populate 3.03. How would i create a field so i can upload the upc code?

Thank you,
Kevin bentham
https://www.glmelectronics.com
https://www.globalgpsnavigation.com

13 Jan 2009, 4:55 AM
#13
axpen avatar

axpen

Inactive

Join Date:
May 2007
Location:
The Mid-west
Posts:
10
Plugin Contributions:
0

Re: UPC For Zencart Delivered

Sorry I'm not 100% familiar with the Numinix solution. I assume it just adds on the field of a UPC or what-not, that's all my addon did. I did this for work through sed-greping the files for anything model and then replicating it with upc. I then added the DB field (again replicating the model one).

I am also unfamiliar w/ Easy Populate, my job has taken me off the inventory position to web and application programming. I would assume you would just tie your field in your CSV file or Excel sheet to the DB field.

e.g. lets assume your file you are uploading looks as follows;
name, price, upc
Erasers, 3.00, 12345678901
Bookmarks, 4.00, 23456789012

and your database is as follows;
table: zen_products
fields: *product_name, **product_price, *product_upc

you should in this case just tie your, "upc" field from your import file to your, "product_upc" field in your database under your, "zen_products" table under your respective database.

Sorry I can't be of more help, if you need specific help regarding the addons you are using perhaps the author's of those addons could be of more help.

Please feel free to post back if you think I can be of more help to you.

--Alex