Page 12 of 28 FirstFirst ... 2101112131422 ... LastLast
Results 111 to 120 of 272
  1. #111
    Join Date
    Jun 2006
    Posts
    22
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Hi,
    I've carefully read this thread - I want to tailor Zencart to fit my needs better: not just the catalog but also the Admin side of things, as more than just I will be admin-ing the store.
    Early on in the thread there was a post about adding a table to the database that would contain the fields being added - this as opposed to simply adding fields to existing tables. I'm trying to determine the risks involved in these two approaches:
    1. if the file structure of the database is ever updated, will new (non-standard to Zen) tables be a. erased? b. ignored? c. updated?
    2. in the scenario above except instead of a new table, fields have been added to existing tables, will the new fields (non-standard to Zen) be a. erased? b. ignored? c. updated?

    On the php pages side of things, I *think* I've finally got my head around using templates. Let's say I have a template called 'roses', for which there is a folder called roses in the
    /store/includes/templates
    folder. Then, if I change a file anywhere in the store, I simply add a folder called roses and place my modded file in it. For example, in the
    /store/includes/languages/english/
    I modified index,php. I added a folder called roses:
    /store/includes/languages/english/roses/
    into which I placed my modded index.php
    This seems to work right the way round the shop... and from what I've read, will keep updates from overwriting your mods. My question is: will this same approach work for modded product_x.php files, i.e., pages that reference new fields and tables?

    I hope that last question wasn't too obscure... can't think of a different, clearer way of asking it...

    Thanks to all that reply...

  2. #112
    Join Date
    Jun 2006
    Posts
    22
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Never mind, think I might have found the answers here...

  3. #113
    Join Date
    Sep 2008
    Posts
    10
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Hi, I have read this thread and its great stuff.

    I am choosing to create a new DB table called "product_recess_attr" it will contant products_id to link it to products

    I've added into the query TABLE_PRODUCT_RECESS_ATTR(IN RED), but I get the following error:

    1146 Table 'zencart.TABLE_PRODUCT_RECESS_ATTR' doesn't exist

    Do I need to define this table elsewhere in zencart?

    Thankyou in advance.


    if (isset($_GET['pID']) && empty($_POST)) {
    $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
    p.products_id, p.products_quantity, p.products_model,
    p.products_image, p.products_price, p.products_virtual, p.products_weight,
    p.products_date_added, p.products_last_modified,
    date_format(p.products_date_available, '%Y-%m-%d') as
    products_date_available, p.products_status, p.products_tax_class_id,
    p.manufacturers_id,
    p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
    p.product_is_free, p.product_is_call, p.products_quantity_mixed,
    p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
    p.products_sort_order,
    p.products_discount_type, p.products_discount_type_from,
    p.products_price_sorter, p.master_categories_id,
    pra.products_min_hole
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
    where p.products_id = '" . (int)$_GET['pID'] . "'
    and pra.products_id = '" . (int)$_GET['pID'] . "'
    and p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");

  4. #114
    Join Date
    Sep 2008
    Posts
    10
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Quote Originally Posted by dukie6675 View Post
    Hi, I have read this thread and its great stuff.

    I am choosing to create a new DB table called "product_recess_attr" it will contant products_id to link it to products

    I've added into the query TABLE_PRODUCT_RECESS_ATTR(IN RED), but I get the following error:

    1146 Table 'zencart.TABLE_PRODUCT_RECESS_ATTR' doesn't exist

    Do I need to define this table elsewhere in zencart?

    Thankyou in advance.


    if (isset($_GET['pID']) && empty($_POST)) {
    $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
    p.products_id, p.products_quantity, p.products_model,
    p.products_image, p.products_price, p.products_virtual, p.products_weight,
    p.products_date_added, p.products_last_modified,
    date_format(p.products_date_available, '%Y-%m-%d') as
    products_date_available, p.products_status, p.products_tax_class_id,
    p.manufacturers_id,
    p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
    p.product_is_free, p.product_is_call, p.products_quantity_mixed,
    p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
    p.products_sort_order,
    p.products_discount_type, p.products_discount_type_from,
    p.products_price_sorter, p.master_categories_id,
    pra.products_min_hole
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
    where p.products_id = '" . (int)$_GET['pID'] . "'
    and pra.products_id = '" . (int)$_GET['pID'] . "'
    and p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");

    I figured out how to define the database table in the: database_tables.php file, now I get this error:


    Warning: reset() [function.reset]: Passed variable is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 29

    Warning: Variable passed to each() is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 30

  5. #115
    Join Date
    Aug 2007
    Location
    Tampa FL.
    Posts
    142
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Quote Originally Posted by dukie6675 View Post
    I figured out how to define the database table in the: database_tables.php file, now I get this error:


    Warning: reset() [function.reset]: Passed variable is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 29

    Warning: Variable passed to each() is not an array or object in /web/zen-cart/admin/includes/classes/object_info.php on line 30
    HTML Code:
    if (isset($_GET['pID']) && empty($_POST)) {
    $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
    p.products_id, p.products_quantity, p.products_model,
    p.products_image, p.products_price, p.products_virtual, p.products_weight,
    p.products_date_added, p.products_last_modified,
    date_format(p.products_date_available, '%Y-%m-%d') as
    products_date_available, p.products_status, p.products_tax_class_id,
    p.manufacturers_id,
    p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
    p.product_is_free, p.product_is_call, p.products_quantity_mixed,
    p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
    p.products_sort_order,
    p.products_discount_type, p.products_discount_type_from,
    p.products_price_sorter, p.master_categories_id,
    pra.products_min_hole
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
    where p.products_id = '" . (int)$_GET['pID'] . "'
    and p.products_id = pd.products_id 
    and p.products_id = pra.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
    it looked like you where trying to get the id twice. the only id you need to get is p.products_id and link all others.

    not sure if this will even work with out allot of other files being edited.

    adding your own tables is a great idea but to edit the core files dose not make it easy when they change or up date the programing you should try to place your files in an overrides folder when you can. you should link the table where needed and make all the files you edited into a override file so you can keep your changes. otherwise you should just add the fields to your products table if you not going to do this to keep your information.

  6. #116
    Join Date
    Sep 2008
    Posts
    10
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Quote Originally Posted by poolprorich View Post
    HTML Code:
    if (isset($_GET['pID']) && empty($_POST)) {
    $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
    p.products_id, p.products_quantity, p.products_model,
    p.products_image, p.products_price, p.products_virtual, p.products_weight,
    p.products_date_added, p.products_last_modified,
    date_format(p.products_date_available, '%Y-%m-%d') as
    products_date_available, p.products_status, p.products_tax_class_id,
    p.manufacturers_id,
    p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
    p.product_is_free, p.product_is_call, p.products_quantity_mixed,
    p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
    p.products_sort_order,
    p.products_discount_type, p.products_discount_type_from,
    p.products_price_sorter, p.master_categories_id,
    pra.products_min_hole
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_RECESS_ATTR . " pra
    where p.products_id = '" . (int)$_GET['pID'] . "'
    and p.products_id = pd.products_id 
    and p.products_id = pra.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
    it looked like you where trying to get the id twice. the only id you need to get is p.products_id and link all others.

    not sure if this will even work with out allot of other files being edited.

    adding your own tables is a great idea but to edit the core files dose not make it easy when they change or up date the programing you should try to place your files in an overrides folder when you can. you should link the table where needed and make all the files you edited into a override file so you can keep your changes. otherwise you should just add the fields to your products table if you not going to do this to keep your information.

    Does my pra.products need to be defined elsewhere? I get an error that it doesnt like passing a variable.

  7. #117
    Join Date
    Aug 2008
    Posts
    47
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Quote Originally Posted by callingrohit View Post
    Thank you chris for your excellent instructions.

    I was able to add the field in the DB and collect_info & preview_info and other files but always missed out on update_info.php. After reading through your instructions I redid everything again, and then realized that the update file was right under my nose but always missed it.

    I also updated the general.php >> function >> includes >> admin since my additional field required a function.

    Now its all sweet.

    Just to let everyone know, if you wanna add a field something like product_description, which would need some textarea, I would suggest you to add the extra field at the end of TABLE_PRODUCTS_DESCRIPTION instead of TABLE_PRODUCTS. Also, go through each of the files listed in the instructions (post #1 of this thread) and search for the product_description field and then add your field along with the product_description.

    Also, while doing this it is very important that the order of fields as in DB is followed when appending the php commands related to the new field in various sql queries in the files. for a better explaination, if say in the DB of TABLE_PRODUCTS_DESCRIPTION you have fields

    product_id
    language_id
    product_description
    product_url
    product_viewed
    product_XYZ <new field appended into the table>

    Now when you modify sql queries, they may be already written as in any of the files mentioned by chris as in the preview_info.php near line 43

    PHP Code:
    if (isset($_GET['read']) && ($_GET['read'] == 'only')) {
           
            
    $pInfo->products_name zen_get_products_name($pInfo->products_id$languages[$i]['id']);
            
    $pInfo->products_description zen_get_products_description($pInfo->products_id$languages[$i]['id']);
            
    $pInfo->products_url zen_get_products_url($pInfo->products_id$languages[$i]['id']);

             
    //THIS IS WHERE THE NEW FIELD WILL GO SINCE IT WILL FOLLOW THE ORDER OF FIELDS FROM THE DB TABLE
            
    $pInfo->products_XYZ zen_get_products_XYZ($pInfo->products_id$languages[$i]['id']);

    } else {

            
    $pInfo->products_name zen_db_prepare_input($products_name[$languages[$i]['id']]);
            
    $pInfo->products_description zen_db_prepare_input($products_description[$languages[$i]['id']]);
            
    $pInfo->products_url zen_db_prepare_input($products_url[$languages[$i]['id']]);

            
    //THIS IS WHERE THE NEW FIELD WILL GO SINCE IT WILL FOLLOW THE ORDER OF FIELDS FROM THE DB TABLE
            
    $pInfo->products_XYZ zen_db_prepare_input($products_XYZ[$languages[$i]['id']]);



    Hope this helps someone. Thanks chris.
    I would also like to add to my message something i just forgot to write earlier...

    it is very important to also update the file copy_to_confirm.php so as to transfer all the fields appropriately over to the duplicate product.

    Otherwise if you don't update this file with the new fields, the data within the fields will not be carried over to the duplicate product.

    have fun !!!

  8. #118
    Join Date
    Sep 2008
    Location
    san diego, ca
    Posts
    30
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Great thread but wondering if this is the way to go for what I need. I sell digital books which have a book #, author, publisher and published date info. I would like the products page to show all these info and be linkable (eg. author is linked to other books of same author) and also be able to search by author and publisher.

    Is it better and easier to use this mod or use attributes? If I use attributes, it may seem that I will be creating a LOT of Option Values since there are thousands of authors and publishers but at least they will be uniform - no chance of duplicate authors and pubs. Then there is the issue of zen product updates losing my data or making it not compatible using this mod - there will eventually be over 100,000 products!

    As for the book #, I can use the Products Model field. For the published date, I can just put that in the product description.

    Thanks!

  9. #119
    Join Date
    Feb 2008
    Posts
    27
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    First off all great thread !! Helped me a lot.Managed to add new field to my product description.
    Added 1 new field - "products_fit" (same as "product_description") to TABLE_PRODUCTS_DESCRIPTION ,
    and 1 new field - "product_fiton" (true or false ) to TABLE_PRODUCTS_DESCRIPTION to check if to display "product_fit" to the products info display page, as i dont need this feature to all of my products.
    Every thing work fine and displays OK until i want to check "products_fiton" if to display additional description on product.
    This is the code that i used:
    PHP Code:
    <!--eof Product description -->
    <!--bof Product fit -->
    <h2 id="productPrices" class="productGeneral"></h2>
    <?php $products_check $db->Execute("select * from " TABLE_PRODUCTS_DESCRIPTION " where products_id = '$products_id'");
         if (
    $products_check->fields['products_fiton'] != "0") {
    } else {
    ?>
    <div id="productDescription">
    <a href="javascript:animatedcollapse.toggle('jason')"><h1 id="productName" class="productGeneral">Show all vehicles which match</h1></a> 
    <div id="jason" style="background: #FFFFCC; display:none">
    <?php if (!empty($product_info->fields['products_fit'])) echo $product_info->fields['products_fit']; ?></div>
    <?php ?>
    <!---eof Product fit -->
    For the check feature display true or false i have edited only tpl_product_info_display.php
    I got inspired from the Dual Pricing Addon.
    this way it does not display enyting from the additional description.Maybe some one can give a hint here to look for the mistake...

    Also i am preparing a post with the steps that i used to make the additional fields: they are editable over the Admin with prewiew, multilanguage suport and work with Easypopulate.

    Best regards Zoli.

  10. #120
    Join Date
    Nov 2008
    Posts
    2
    Plugin Contributions
    0

    Default Re: How-To: Add new Properties to your Products

    Hi crazy_chris, I have been able to apply this and it works. So I was able to add other properties like format, publisher, author, etc to my bookshop. However, I tried to add things like Sample page, Table of contents but it would not work because, the text boxes seem to only accept one line of text. So for any bulleted information such as Table of Contents, it would only place the first line when I try to paste copied article in it only the first line would paste. Is there a way to make it look like the product description text box so it can accept multiple lines of texts even in pasting?

    Again is there a way to make it linked texts such that I can type "Table of Contents" and create a hyperlink to a place where it would show the Table of Contents in a page of its own?

    I would really appreciate any support on this.

    Uche (vastcollection.com)

 

 
Page 12 of 28 FirstFirst ... 2101112131422 ... LastLast

Similar Threads

  1. change how latest products works or add new box that displays products we select
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 12 Oct 2010, 04:19 PM
  2. shopping cart contents and new properties to the products
    By stitchnkitty in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 10 Nov 2009, 05:50 PM
  3. Replies: 4
    Last Post: 20 Jun 2009, 04:06 PM
  4. !! Please help !! Add new Properties to your Products
    By JohnSquier in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 27 Feb 2008, 05:46 AM
  5. alter and add new product properties
    By jmitton in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 20 Jan 2008, 03:24 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