Page 359 of 359 FirstFirst ... 259309349357358359
Results 3,581 to 3,586 of 3586
  1. #3581
    Join Date
    Jul 2012
    Posts
    16,778
    Plugin Contributions
    17

    Default Re: Stock by Attribute v4.0 for Zen Cart 1.3.5

    Question asked elsewhere relates to adding other SBA created fields to product searches. For example, there is a description field added to the admin area and the user would like to have that content searchable.

    A while back a new auto loading observer class was added to the catalog side to support searching the custom ID. This can be further modified to include other SBA/PWAS fields.

    The file in question is: includes/classes/observers/auto.advanced_search_categories_custom_id.php

    A duplicate file name could possibly be created for the additional content but also the file name could be changed. Really would suggest making good notes in the file.

    Anyways, around line 166, there is/ was this code:
    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " 
                                               WHERE customid LIKE '%:keywords%')";
    The permalink was: https://github.com/mc12345678/Stock_....php#L166-L169

    Anyway, that snippet specifically retrieves product ids that have a custom ID containing or like the keywords searched.

    Data in the SBA/PWAS table can be added to that parenthetical group for searching. I would suggest though adding an alias to the table to prevent potential version differences from bringing out some sort of conflict.

    So first would change that to:
    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
                                               WHERE pwas.customid LIKE '%:keywords%')";
    Then to aid in expansion I would break some of the content so that endings are on their own line. This way, new code is both easier to add and easier to find when added.

    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
                                               WHERE 
                                                   pwas.customid LIKE '%:keywords%'
                   ) 
                   ";
    And then add the requested information:

    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
                                               WHERE 
                                                   pwas.customid LIKE '%:keywords%'
                                                   OR pwas.title LIKE '%:keywords%'
                   ) 
                   ";
    I note that while in the admin screen the column is shown as a description, the database field name was title and also that the base installation supports basically 100 characters.

    I'm also aware others have added fields to that table in support of whatever additional features they've added. I would expect a similar error to include those additional fields in the search.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #3582
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    454
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 for Zen Cart 1.3.5

    Quote Originally Posted by mc12345678 View Post
    Question asked elsewhere relates to adding other SBA created fields to product searches. For example, there is a description field added to the admin area and the user would like to have that content searchable.

    A while back a new auto loading observer class was added to the catalog side to support searching the custom ID. This can be further modified to include other SBA/PWAS fields.

    The file in question is: includes/classes/observers/auto.advanced_search_categories_custom_id.php

    A duplicate file name could possibly be created for the additional content but also the file name could be changed. Really would suggest making good notes in the file.

    Anyways, around line 166, there is/ was this code:
    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " 
                                               WHERE customid LIKE '%:keywords%')";
    The permalink was: https://github.com/mc12345678/Stock_....php#L166-L169

    Anyway, that snippet specifically retrieves product ids that have a custom ID containing or like the keywords searched.

    Data in the SBA/PWAS table can be added to that parenthetical group for searching. I would suggest though adding an alias to the table to prevent potential version differences from bringing out some sort of conflict.

    So first would change that to:
    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
                                               WHERE pwas.customid LIKE '%:keywords%')";
    Then to aid in expansion I would break some of the content so that endings are on their own line. This way, new code is both easier to add and easier to find when added.

    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
                                               WHERE 
                                                   pwas.customid LIKE '%:keywords%'
                   ) 
                   ";
    And then add the requested information:

    Code:
              $where_str .= "OR p.products_id 
                                               IN (SELECT products_id 
                                                    FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
                                               WHERE 
                                                   pwas.customid LIKE '%:keywords%'
                                                   OR pwas.title LIKE '%:keywords%'
                   ) 
                   ";
    I note that while in the admin screen the column is shown as a description, the database field name was title and also that the base installation supports basically 100 characters.

    I'm also aware others have added fields to that table in support of whatever additional features they've added. I would expect a similar error to include those additional fields in the search.
    Are the code changes that you recommend required to get the search to work?

  3. #3583
    Join Date
    Jul 2012
    Posts
    16,778
    Plugin Contributions
    17

    Default Re: Stock by Attribute v4.0 for Zen Cart 1.3.5

    Quote Originally Posted by jodean View Post
    Are the code changes that you recommend required to get the search to work?
    To use/reuse the existing code intended to offer search of SBA data, yes at least the last change was needed. The operation can be accomplished any number of other ways and may depend on other installed software.

    The above fix or addition adds the search capability that was requested in another separate thread of wanting to search the SBA description.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #3584
    Join Date
    Aug 2020
    Location
    Richarson
    Posts
    117
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 for Zen Cart 1.3.5

    Quote Originally Posted by mc12345678 View Post
    So, I went back to review the modification I applied. There was an issue with the query I created, it had an extra semi-colon from when I copied and pasted it from within phpMyAdmin.

    The issues about the missing constant, well that is something that would be seen with the code in place, visitors navigating the site until the database install was completed. I've made generated a change to the code to prevent logging that issue; however, in a way the fix is unnecessary once the appropriate constant has been set either in a file or the database.

    But, the other above issues? I have no idea how the other issues exist in your file. I do not see github history of the problem content like:
    1) I don't see what the issue is with the option list, the three options appear to have the same format with just differences in associated/necessary data. So i'm not sure what issue is/was created there.
    2) semi-colons as a part of case statements, these specifically are supposed to be colons, there is nothing that I found having semi-colons in that spot.

    I have created and force pushed an update for the original issue for the query to do what was requested: Adds all new product/attribute pairs for single attribute not yet in SBA · mc12345678/Stock_By_Attributes_Combined@064350f (github.com)

    https://github.com/mc12345678/Stock_...326c26a8192f01
    I am reaching out because I thought this error (missing constant) was resolved, but it is still arriving. I am not clear on specifically what I need to do when you say "once the appropriate constant has been set either in a file or the database". Can you please advise what I need to do to resolve? I saw the updated install file and updated, but am not sure if that is all that needed to be done to resolve the missing constant. Thank you so much.

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

    Default Re: Stock by Attribute v4.0 for Zen Cart 1.3.5

    Quote Originally Posted by chuckrey View Post
    I am reaching out because I thought this error (missing constant) was resolved, but it is still arriving. I am not clear on specifically what I need to do when you say "once the appropriate constant has been set either in a file or the database". Can you please advise what I need to do to resolve? I saw the updated install file and updated, but am not sure if that is all that needed to be done to resolve the missing constant. Thank you so much.
    No problem.

    The issue of the missing constant is expected to be non-existent upon installation of the software in an operational state. The purest state would be to:
    1. have a base Zen Cart package,
    2. load the SBA files from github merging the template changes as necessary for that additional template functionality
    3. log into your admin
    4. change the url path to access: stock_by_attr_install.php.

    For ZC 1.5.8, that would be like: mydomain/MYADMIN/index.php?cmd=stock_by_attr_install
    The installation file can also be executed by mydomain/MYADMIN/stock_by_attr_install.php

    5. Once see the generated window (in ZC 2.X may also have a message across the header and a debug log generated indicating an issue with the header), in the dropdown at the top of the screen select: Full/Upgrade DB Install
    6. press the button to run the script.

    This will add/create the constant that is missing (PRODUCTS_OPTIONS_TYPE_SELECT_SBA).

    If there are other files laying around in the installation then those may be the one(s) generating the logs.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #3586
    Join Date
    Aug 2020
    Location
    Richarson
    Posts
    117
    Plugin Contributions
    0

    Default Re: Stock by Attribute v4.0 for Zen Cart 1.3.5

    Quote Originally Posted by mc12345678 View Post
    No problem.

    The issue of the missing constant is expected to be non-existent upon installation of the software in an operational state. The purest state would be to:
    1. have a base Zen Cart package,
    2. load the SBA files from github merging the template changes as necessary for that additional template functionality
    3. log into your admin
    4. change the url path to access: stock_by_attr_install.php.

    For ZC 1.5.8, that would be like: mydomain/MYADMIN/index.php?cmd=stock_by_attr_install
    The installation file can also be executed by mydomain/MYADMIN/stock_by_attr_install.php

    5. Once see the generated window (in ZC 2.X may also have a message across the header and a debug log generated indicating an issue with the header), in the dropdown at the top of the screen select: Full/Upgrade DB Install
    6. press the button to run the script.

    This will add/create the constant that is missing (PRODUCTS_OPTIONS_TYPE_SELECT_SBA).

    If there are other files laying around in the installation then those may be the one(s) generating the logs.
    Ah, okay. I missed the last and most important step. Just completed. Thanks yet again!

 

 

Similar Threads

  1. Problems with addon: Dynamic Drop Downs for Stock By Attribute
    By Dunk in forum All Other Contributions/Addons
    Replies: 56
    Last Post: 30 Apr 2014, 07:55 PM
  2. MySQL Problem with Product with Attribute Stock addon
    By rtwingfield in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 20 Sep 2011, 03:35 PM
  3. Hide Zero Quantity Attributes with attribute-stock addon
    By leevil123 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 11 Feb 2010, 05:06 PM
  4. Replies: 4
    Last Post: 22 Jan 2010, 10:43 PM
  5. Price Products in the grid by 'Stock by Attribute' addon?
    By Salixia in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 27 Oct 2009, 06:03 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