Page 1 of 14 12311 ... LastLast
Results 1 to 10 of 154

Hybrid View

  1. #1
    Join Date
    Aug 2004
    Location
    United Kingdom
    Posts
    32
    Plugin Contributions
    0

    Default Adding New Product_types

    Hi,

    I am trying to customise my Zen Cart install to create a couple of new product_types in the same way that you have added the product_music type. I am having trouble with it to be honest.

    I managed to copy the code for adding new Record Companies and rejig it to allow me to add Product Materials to a new table in my database, with a few hours of messing about, creating new language files and adding to existing files its all finished and working.

    Now I copied the file product_music.php to /admin/product_body_jewellery.php and in an attempt to create a new product type entry page where I could customise it further to allow me to have a product type that has product material and product body part options. Unfortunately, at this stage I am unsure what to do...when I try to access my new file some of the page content including header, etc is displayed but after a little while I redirected in what appears to be a redirecting loop.

    Can you tell me what the coding requirements are for setting up a new product type so that I can tinker and try and get a grasp of how this works. I think it is best that I try to implement the product_type that I require in the ZenCart and submit it to yourselves for possible inclusion of new releases rather than bombard you with requests to implement it.

    Any help would be greatly appreciated :).

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default

    Good strategy!

    Did you duplicate these files as well?
    - /admin/products_music.php
    - /admin/includes/modules/product_music/*.php

    and
    - /includes/modules/pages/product_music/*.php
    - /includes/templates/TEMPLATE/templates/product_music*.php
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Aug 2004
    Location
    United Kingdom
    Posts
    32
    Plugin Contributions
    0

    Default

    Thanks for getting back to me. From what I can see I have actually duplicated all of the files for product_music to my new product type product_body_jewellery.

    [root@boar www.giftsforgoths.com]# find -name "*product_music*"
    ./admin/product_music.php
    ./admin/includes/languages/english/product_music.php
    ./admin/includes/languages/english/extra_definitions/product_music.php
    ./admin/includes/boxes/extra_boxes/product_music_extras_dhtml.php
    ./admin/includes/modules/product_music
    ./admin/includes/functions/extra_functions/product_music_functions.php
    ./includes/languages/english/product_music_info.php
    ./includes/languages/english/extra_definitions/product_music.php
    ./includes/modules/pages/product_music_info
    ./includes/templates/template_default/templates/tpl_product_music_info_display.php
    ./includes/templates/custom_template/templates/tpl_product_music_info_display.php
    [root@boar www.giftsforgoths.com]# find -name "*product_body_jewellery*"
    ./admin/includes/languages/english/extra_definitions/product_body_jewellery.php
    ./admin/includes/languages/english/product_body_jewellery.php
    ./admin/includes/boxes/extra_boxes/product_body_jewellery_extras_dhtml.php
    ./admin/includes/modules/product_body_jewellery
    ./admin/includes/functions/extra_functions/product_body_jewellery_functions.php
    ./admin/product_body_jewellery.php
    ./includes/languages/english/extra_definitions/product_body_jewellery.php
    ./includes/languages/english/product_body_jewellery_info.php
    ./includes/modules/pages/product_body_jewellery_info
    ./includes/templates/template_default/templates/tpl_product_body_jewellery_info_display.php
    ./includes/templates/custom_template/templates/tpl_product_body_jewellery_info_display.php

    I go to the categories page in the /admin section and attempt to add a product (Product - Body Jewellery) from the list (which I can fathom is generated from the product_types table) the header displays. I can see that the code gets as far as testing what action is to be performed ie. new_product at which point it includes the collect_info.php file for the appropriate product_handler (being product_body_jewellery).

    ......

    comes back after five minutes and realises that some code I added last week to the collect_info.php page was actually going round in a loop. doh. Sorry for any inconvenience....its now displaying.

    As my colleague here always says you need a Cat to talk it through to make things clearer in your head. Thanks all the same mate.

  4. #4
    Join Date
    Aug 2004
    Location
    United Kingdom
    Posts
    32
    Plugin Contributions
    0

    Default

    One last thing, I don't suppose ZenCart has any built in functions to deal specifically with form select fields with multiple options to select? I have done a few tests and it looks like on the last value selected of say 'body_part_id' appears in the $HTTP_POST_VARS array and none of the others selected.

    Doing a quick google some people are saying that if you need to use the select input for multiple selections that you need to use the GET method to sent the data....which kinda makes this a hell of a lot more complicated than I thought :S

  5. #5
    Join Date
    Feb 2004
    Location
    Fort Collins, CO
    Posts
    21
    Plugin Contributions
    0

    Default

    Here is a little summary of what I had to do to add a new product type. This only covers the catalog section. Everything seems to be working OK. I've not tested it extensively by any means, so YMMV.


    These are the files that I had to create in order to setup a new product_magnet type. 'TEMPLATE', of course, refers to your custom template directory.

    includes/extra_datafiles/magnet_type_database_names.php
    includes/languages/english/extra_definitions/product_magnet.php
    includes/languages/english/product_magnet_info.php
    includes/languages/english/TEMPLATE/product_magnet_info.php
    includes/modules/pages/product_magnet_info/header_php.php
    includes/modules/pages/product_magnet_info/jscript_main.php
    includes/modules/pages/product_magnet_info/main_template_vars.php
    includes/modules/pages/product_magnet_info/main_template_vars_attributes.php
    includes/modules/pages/product_magnet_info/main_template_vars_images.php
    includes/modules/pages/product_magnet_info/main_template_vars_images_additional.php
    includes/templates/TEMPLATE/templates/tpl_product_magnet_info_display.php

    1. includes/extra_datafiles/magnet_type_database_names.php

    Code:
       define('TABLE_PRODUCT_MAGNET_EXTRA', DB_PREFIX . 'product_magnet_extra');
       define('TABLE_MAGNET_PLATE', DB_PREFIX . 'magnet_plate');
       define('TABLE_MAGNET_GRADE', DB_PREFIX . 'magnet_grade');
    These three definitions are tables that I created in my database. Only the first definition is necessary. It, among other things, holds the id references for the other tables. The other two tables contain supporting data that you will have to design and input manually. You can probably use the other tables for the music genre as templates.


    2. includes/languages/english/extra_definitions/product_magnet.php

    Code:
    define('BOX_HEADING_SPECS', 'Magnet Specifications');
    This was the only definition that I needed. Pretty self explanitory. This is the extra english text that goes on your product_info page.

    3. includes/languages/english/product_magnet_info.php
    -OR-
    includes/languages/english/YOUR_TEMPLATE/product_magnet_info.php

    Copy the file product_music_info.php from the same directory and begin editing to your taste. Don't add any extra definitions... just change the ones that are there. If you need to add more definitions, then do it in step #2.

    4. Copy the entire directory includes/modules/pages/product_music_info
    to
    includes/modules/pages/product_YOURTYPE_info/

    5. includes/modules/pages/product_magnet_info/header_php.php
    includes/modules/pages/product_magnet_info/jscript_main.php

    NOTHING TO DO!!!


    6. includes/modules/pages/product_magnet_info/main_template_vars.php

    This file needs some serious consideration. This is where you will be grabbing all of your special information from the DB regarding this specific product. If you are database challenged, this is going to be difficult.. but not impossible!

    Fortunately our friendly Zen Admin's have given us a good template in the product_music type. Read through it a few times.

    7. includes/modules/pages/product_magnet_info/main_template_vars_attributes.php

    Very few changes here. Only two lines changed to add the music product type.

    This line (110):
    Code:
    if (((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) or (CUSTOMERS_APPROVAL_AUTHORIZATION == 2 and $_SESSION['customers_authorization'] != 0)) {
    Code:
    was changed to:
    if ((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) {
    And this line (170):
    Code:
    if ((SHOW_PRODUCT_INFO_WEIGHT_ATTRIBUTES=='1' and $products_options->fields['products_attributes_weight'] != '0')) {
    was changed to:
    Code:
     
         if ((SHOW_PRODUCT_MUSIC_INFO_WEIGHT_ATTRIBUTES=='1' and $products_options->fields['products_attributes_weight'] != '0')) {
    I didn't have to change any of this since my product type doesn't use attributes.


    8. includes/modules/pages/product_magnet_info/main_template_vars_images.php
    includes/modules/pages/product_magnet_info/main_template_vars_images_additional.php

    NOTHING TO DO!!!

    9. includes/templates/TEMPLATE/templates/tpl_product_magnet_info_display.php

    This is the file to customize how the product is displayed. You will want to make sure you are displaying all of the special information out of the database.


    THE END

    Hopefully this will do more good than harm. Let me know if anything is unclear, missing, or just plain wrong. I'll try to put the instructions for the admin section up later on.

  6. #6

    Default Re: Adding New Product_types

    Quote Originally Posted by gaussboy View Post
    Here is a little summary of what I had to do to add a new product type. This only covers the catalog section. Everything seems to be working OK. I've not tested it extensively by any means, so YMMV.


    These are the files that I had to create in order to setup a new product_magnet type. 'TEMPLATE', of course, refers to your custom template directory.

    includes/extra_datafiles/magnet_type_database_names.php
    includes/languages/english/extra_definitions/product_magnet.php
    includes/languages/english/product_magnet_info.php
    includes/languages/english/TEMPLATE/product_magnet_info.php
    includes/modules/pages/product_magnet_info/header_php.php
    includes/modules/pages/product_magnet_info/jscript_main.php
    includes/modules/pages/product_magnet_info/main_template_vars.php
    includes/modules/pages/product_magnet_info/main_template_vars_attributes.php
    includes/modules/pages/product_magnet_info/main_template_vars_images.php
    includes/modules/pages/product_magnet_info/main_template_vars_images_additional.php
    includes/templates/TEMPLATE/templates/tpl_product_magnet_info_display.php

    1. includes/extra_datafiles/magnet_type_database_names.php

    Code:
       define('TABLE_PRODUCT_MAGNET_EXTRA', DB_PREFIX . 'product_magnet_extra');
       define('TABLE_MAGNET_PLATE', DB_PREFIX . 'magnet_plate');
       define('TABLE_MAGNET_GRADE', DB_PREFIX . 'magnet_grade');
    These three definitions are tables that I created in my database. Only the first definition is necessary. It, among other things, holds the id references for the other tables. The other two tables contain supporting data that you will have to design and input manually. You can probably use the other tables for the music genre as templates.


    2. includes/languages/english/extra_definitions/product_magnet.php

    Code:
    define('BOX_HEADING_SPECS', 'Magnet Specifications');
    This was the only definition that I needed. Pretty self explanitory. This is the extra english text that goes on your product_info page.

    3. includes/languages/english/product_magnet_info.php
    -OR-
    includes/languages/english/YOUR_TEMPLATE/product_magnet_info.php

    Copy the file product_music_info.php from the same directory and begin editing to your taste. Don't add any extra definitions... just change the ones that are there. If you need to add more definitions, then do it in step #2.

    4. Copy the entire directory includes/modules/pages/product_music_info
    to
    includes/modules/pages/product_YOURTYPE_info/

    5. includes/modules/pages/product_magnet_info/header_php.php
    includes/modules/pages/product_magnet_info/jscript_main.php

    NOTHING TO DO!!!


    6. includes/modules/pages/product_magnet_info/main_template_vars.php

    This file needs some serious consideration. This is where you will be grabbing all of your special information from the DB regarding this specific product. If you are database challenged, this is going to be difficult.. but not impossible!

    Fortunately our friendly Zen Admin's have given us a good template in the product_music type. Read through it a few times.

    7. includes/modules/pages/product_magnet_info/main_template_vars_attributes.php

    Very few changes here. Only two lines changed to add the music product type.

    This line (110):
    Code:
    if (((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) or (CUSTOMERS_APPROVAL_AUTHORIZATION == 2 and $_SESSION['customers_authorization'] != 0)) {
    Code:
    was changed to:
    if ((CUSTOMERS_APPROVAL == '2' and $_SESSION['customer_id'] == '') or (STORE_STATUS == '1')) {
    And this line (170):
    Code:
    if ((SHOW_PRODUCT_INFO_WEIGHT_ATTRIBUTES=='1' and $products_options->fields['products_attributes_weight'] != '0')) {
    was changed to:
    Code:
     
         if ((SHOW_PRODUCT_MUSIC_INFO_WEIGHT_ATTRIBUTES=='1' and $products_options->fields['products_attributes_weight'] != '0')) {
    I didn't have to change any of this since my product type doesn't use attributes.


    8. includes/modules/pages/product_magnet_info/main_template_vars_images.php
    includes/modules/pages/product_magnet_info/main_template_vars_images_additional.php

    NOTHING TO DO!!!

    9. includes/templates/TEMPLATE/templates/tpl_product_magnet_info_display.php

    This is the file to customize how the product is displayed. You will want to make sure you are displaying all of the special information out of the database.


    THE END

    Hopefully this will do more good than harm. Let me know if anything is unclear, missing, or just plain wrong. I'll try to put the instructions for the admin section up later on.
    Once you complete this what do you have to do on the admin side to actually get this new product type to function when adding new products?

  7. #7
    Join Date
    Mar 2007
    Posts
    56
    Plugin Contributions
    0

    Default Re: Adding New Product_types

    Hi,

    rather than searching and reading through all 10 pages, could someone please point me to information as to how to add new product types in Zencart 1.3.7

  8. #8
    Join Date
    Jan 2008
    Posts
    9
    Plugin Contributions
    0

    Default Re: Adding New Product_types

    There is got to be a easier way of adding a new product type, seeing as videos should have been listed already. I was told zen cart was easy, but being I need a catagory for videos, my shop won´t be up this year - if that is what I have to do to add a video product.

  9. #9
    Join Date
    Jul 2004
    Posts
    246
    Plugin Contributions
    0

    Default Re: Adding New Product_types

    Can someone please post the steps needed in order to make multiple copies of the product general product type.

    This may sound strange so let me explain why.
    I have a shop with products that need different attributes. As I wanted to lay out the attributes in a particular way that is not possible with Zen Cart I had to hand code the changes in product_ifo_display.php. Look at www.gobetweencards.co.uk to see what I mean.

    Some products have image attributes and some do not hence why I need multiple copies of the general product type so that I can have a custom product_ifo_display.php for each type of product.

    Any pointers would be grately appreciated.
    UK based Zen Cart Web Designer here www.handcoded.co.uk

  10. #10
    Join Date
    Jun 2008
    Posts
    1
    Plugin Contributions
    0

    Default Re: Adding New Product_types

    Quote Originally Posted by maraud View Post
    Hi,

    rather than searching and reading through all 10 pages, could someone please point me to information as to how to add new product types in Zencart 1.3.7

    I second that. I have trawled through this post, and found lots of posts with codes in. I'm new to Zen Cart and shopping carts/e-commerce in general, so an easy update with the relevant code to add a new product type would be greatly appreciated!!

    Thanks

 

 
Page 1 of 14 12311 ... LastLast

Similar Threads

  1. Is there a way of adding a product but stopping it from adding to new products?
    By philpalmerdevon in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 19 Jan 2009, 02:07 PM
  2. When adding new parts, adding part number to preview screen
    By GTHENRY in forum Basic Configuration
    Replies: 1
    Last Post: 18 Jun 2008, 07:53 PM
  3. product_types.php details
    By MarkRS in forum Setting Up Categories, Products, Attributes
    Replies: 12
    Last Post: 30 Sep 2006, 06:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR