Results 1 to 8 of 8
  1. #1
    Join Date
    Apr 2009
    Posts
    417
    Plugin Contributions
    2

    Default 1.5.7 addition observers Product info - not getting my head arround them

    Moving to 1.5.7. Currently 1.5.6. php 7.3.6 mysql 5.6.43 Quite a few mods.
    I had written myself a mod to add the product location to enable me to easily find my products. In 1.5.6 I create a new table and added the products_id and products location to the table. I then change all the collect_info.php and preview_info files.

    I now see that you have added new observers to the collect_info files.
    I am just having trouble getting my head around how to use it to populate the data and display the data.

    I already use an observer for product delete to remove the entry from the products_location table.

    It looks like I can use NOTIFY_ADMIN_PRODUCT_COLLECT_INFO_EXTRA_INPUTS to display the info and allow user input.
    Any pointers as to where I get the info back to update my table?
    Or do i need to mod the products table to add the new field?

    Any help welcome.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,144
    Plugin Contributions
    11

    Default Re: 1.5.7 addition observers Product info - not getting my head arround them

    Why not just use the built-in search in the admin? Referenced at https://www.zen-cart.com/showthread....93#post1369993

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,475
    Plugin Contributions
    88

    Default Re: 1.5.7 addition observers Product info - not getting my head arround them

    FWIW, I find no reference to NOTIFY_ADMIN_PRODUCT_COLLECT_INFO_EXTRA_INPUTS within the just-released zc157 fileset.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: 1.5.7 addition observers Product info - not getting my head arround them

    Quote Originally Posted by lat9 View Post
    FWIW, I find no reference to NOTIFY_ADMIN_PRODUCT_COLLECT_INFO_EXTRA_INPUTS within the just-released zc157 fileset.
    https://github.com/zencart/zencart/b..._info.php#L210
    And:
    https://github.com/zencart/zencart/b..._info.php#L210

    Second one is the released version
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: 1.5.7 addition observers Product info - not getting my head arround them

    Quote Originally Posted by brittainmark View Post
    Moving to 1.5.7. Currently 1.5.6. php 7.3.6 mysql 5.6.43 Quite a few mods.
    I had written myself a mod to add the product location to enable me to easily find my products. In 1.5.6 I create a new table and added the products_id and products location to the table. I then change all the collect_info.php and preview_info files.

    I now see that you have added new observers to the collect_info files.
    I am just having trouble getting my head around how to use it to populate the data and display the data.

    I already use an observer for product delete to remove the entry from the products_location table.

    It looks like I can use NOTIFY_ADMIN_PRODUCT_COLLECT_INFO_EXTRA_INPUTS to display the info and allow user input.
    Any pointers as to where I get the info back to update my table?
    Or do i need to mod the products table to add the new field?

    Any help welcome.
    What is meant by "products location"? Is this say a shelf number in the warehouse? A building associated with its storage or availability? A link to the catalog side of the store? A link to the edit and/or price manager for the product?

    Unfortunately it's not yet clear what the need is for this additional table.

    As to the notifier/observer, by being on the collect_info page, either it can be used to display information that has been made available "above" that line (or originally generated at that line), it can be used to retrieve information from above that line or depending on execution sequence from some other observer of that notification, basically. If you want to capture something that has been newly entered on the product information page, then would need to collect that information later either in the load of the preview of the information, the update of the information or even *from* that same collect_info page but based on some form of javascript loaded during that page load that captures the desired information and makes it available for such processing and storage...

    Kind of depends on what your data source is which leads back to the above question.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,684
    Plugin Contributions
    9

    Default Re: 1.5.7 addition observers Product info - not getting my head arround them

    Quote Originally Posted by dbltoe View Post
    Why not just use the built-in search in the admin? Referenced at https://www.zen-cart.com/showthread....93#post1369993
    not really sure how these 2 things are related. the change mentioned in the above link is primarily about product display on the admin side and cleaning up the sorting options. the combined listings of categories and products, at least to me, was always a tad confusing and not implemented in a manner i felt appropriate. the change referenced in the link allows for sorting of search results. 1.5.6 did not allow for sorting of search results as you would get a search result set, and when you attempted to sort it, you lost the search results. in addition, the sorting of the search result set was always based on the category sort, not the product sort.

    i had previously implemented this feature for my clients, and frankly it made sense to make it available to the community. apparently the core code maintainers agreed which is why it is now part of the ZC core.

    Quote Originally Posted by mc12345678 View Post
    What is meant by "products location"? Is this say a shelf number in the warehouse? A building associated with its storage or availability? A link to the catalog side of the store? A link to the edit and/or price manager for the product?

    Unfortunately it's not yet clear what the need is for this additional table.

    As to the notifier/observer, by being on the collect_info page, either it can be used to display information that has been made available "above" that line (or originally generated at that line), it can be used to retrieve information from above that line or depending on execution sequence from some other observer of that notification, basically. If you want to capture something that has been newly entered on the product information page, then would need to collect that information later either in the load of the preview of the information, the update of the information or even *from* that same collect_info page but based on some form of javascript loaded during that page load that captures the desired information and makes it available for such processing and storage...

    Kind of depends on what your data source is which leads back to the above question.
    brittainmark, please correct me if i'm wrong, but when you say location, you are referring to a physical product location. none of the other guesses in these posts seem to make sense to me. as those guesses as to what you might mean are readily available and found.

    unfortunately inventory management is not really done adequately in ZC. the popularity of the plugin stock by attributes only attests to the need for inventory to be done better (or potentially integrated).

    your question is actually a good one. the observer allows one to collect additional information for a particular product. i am guessing that you would need to update your data using another observer. probably here:

    https://github.com/zencart/zencart/b...oduct.php#L124

    PHP Code:
    $zco_notifier->notify('NOTIFY_MODULES_UPDATE_PRODUCT_END', array('action' => $action'products_id' => $products_id)); 
    i can only "assume" that the $_POSTS from the collect info observer would be available at that time, but i have not tested it.

    as someone who has incorporated numerous extra fields for product types, i would stick with your initial design of a separate table. no need to change that by adding a new field to the product table.

    i hope that helps and is not more confusing.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,475
    Plugin Contributions
    88

    Default Re: 1.5.7 addition observers Product info - not getting my head arround them

    You might use the Zen Products (and Tag Cloud) as your model; that's the plugin from which those notifiers were incorporated in the first place!

  8. #8
    Join Date
    Apr 2009
    Posts
    417
    Plugin Contributions
    2

    Default Re: 1.5.7 addition observers Product info - not getting my head arround them

    Thanks for all the interest guys. I think I have finally go my head around it with all the extra notifiers I have manage to rewrite the mod just changing 3 core file.
    The way I did it was to just allow a simple text entry to be stored for a product to tell me where it is. I suppose to do I properly I really should have a table of locations and link the location to the product like product to categories. Might look at that later! But for know I have it working using the following notifiers
    'NOTIFY_ADMIN_PRODUCT_COLLECT_INFO_EXTRA_INPUTS',
    'NOTIFIER_ADMIN_ZEN_REMOVE_PRODUCT',
    'NOTIFY_PRODUCT_MUSIC_UPDATE_PRODUCT_END',
    'NOTIFY_PRODUCT_MUSIC_COPY_TO_CONFIRM_DUPLICATE',
    'NOTIFY_MODULES_COPY_TO_CONFIRM_DUPLICATE',
    'NOTIFY_MODULES_UPDATE_PRODUCT_END'

    A couple of trip ups were the fact that product info is now an object so needed to use $p1->products_id and not $p1['products_id'] this is only in the collect_info modules.
    The second was realising that the $extra_product_inputs needs to be an array of arrays so
    PHP Code:
     $p2 = array('products_location'=>array(
                           
    'label'=> array(
                             
    'text' => TEXT_PRODUCTS_LOCATION,
                             
    'field_name' =>'products_location'),
                           
    'input' => $input)); 
    I also gave mine a name just in case I find anyone else using it.
    Finally I have even sanitised the input which I must say was surprisingly easy (so good job who ever wrote that!)
    PHP Code:
    $sanitizer AdminRequestSanitizer::getInstance();
    $group = array(
        
    'products_location' => array('sanitizerType' => 'ALPHANUM_DASH_UNDERSCORE''method' => 'post'),
    );
    $sanitizer->addComplexSanitization($group); 
    Thanks Again for all the interest. Might even post it as a mod later.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

 

 

Similar Threads

  1. v151 Email Issues for admin - not getting some of them!
    By mzunderstood in forum General Questions
    Replies: 5
    Last Post: 20 Nov 2012, 05:12 AM
  2. Replies: 8
    Last Post: 28 Feb 2012, 03:05 PM
  3. Observers and Session Objects - not getting notified
    By avibodha in forum General Questions
    Replies: 2
    Last Post: 27 Feb 2011, 02:20 AM
  4. adding product specific info into <head> tags on product pages for facebook
    By donplay in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 17 Feb 2010, 01:34 PM
  5. Unwanted space at head of product info pages
    By johnandrobin in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Dec 2008, 07:14 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