Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Products Specifications


kymation

Recommended Posts

Thanks,

but the pd prefix is missing in the original query  whatever field is used as filter from that table.

So my question is what went wrong, and where does it retrieve the needed prefix from as I cant see any reference to the products_description table 

in this query in the original catalog/includes/classes/specifications.php file for those specific specification filters

.As you can see from the code snippet, I added  with a little hope a ref. to the table myself and got rid of the error  message,

but that of course shouldn't be enough. So those filters still do not work ...

david

Link to comment
Share on other sites

Works when I add :

                 if ($products_column_name == 'products_name') {
                         $products_column_name = 'pd.' . $products_column_name;
                 } // if ($products_column_name == 'products_name')

around line 340 in catalog/includes/classes/specifications.php just below this code:

                // The Manufacturer's column contains an ID and not the name, so we have to change it
                if ($products_column_name == 'manufacturers_id') {
                        $filter_array = tep_get_manufacturer_id($filter_array, $products_column_name);
                        $products_column_name = 'p.' . $products_column_name;
                } // if ($products_column_name == 'manufacturers_id')

Filter work for the products_name on the products  listings, but I am sure it's not how it is supposed to.

If someone can tell where the process should actually happen and where a  mix in files or mods occured, I would really appreciate.

Thanks

 

david

Link to comment
Share on other sites

What I meant is the left join pd should apply in the mysql statement as shown below, and not in your PHP code:

select count(p.products_id) as count from (products p) join (products_to_categories p2c) on (p.products_id = p2c.products_id) left join (specials s) on (p.products_id = s.products_id) /* left join (products_description pd) on (p.products_id = pd.products_id) */ INNER JOIN products_specifications ps17 ON p.products_id = ps17.products_id where p.products_status = '1' and p2c.categories_id = '432' and pd.products_name sounds like '%PoE%' AND ps17.specification <=> 'Oui' AND ps17.specifications_id = '17' AND ps17.language_id = '3'
Link to comment
Share on other sites

6 hours ago, kgtee said:

What I meant is the left join pd should apply in the mysql statement as shown below, and not in your PHP code:


select count(p.products_id) as count from (products p) join (products_to_categories p2c) on (p.products_id = p2c.products_id) left join (specials s) on (p.products_id = s.products_id) /* left join (products_description pd) on (p.products_id = pd.products_id) */ INNER JOIN products_specifications ps17 ON p.products_id = ps17.products_id where p.products_status = '1' and p2c.categories_id = '432' and pd.products_name sounds like '%PoE%' AND ps17.specification <=> 'Oui' AND ps17.specifications_id = '17' AND ps17.language_id = '3'

Thanks, but as said

The original base code from PS catalog class does not include a pd prefix as shown below:

      $raw_query_from = " from (" . TABLE_PRODUCTS . " p)
                            join (" . TABLE_PRODUCTS_TO_CATEGORIES . " p2c)
                              on (p.products_id = p2c.products_id)
                            left join (" . TABLE_SPECIALS . " s)
                              on (p.products_id = s.products_id)
                        ";

The commented part for testing inside /* -- */, see  the error message is my little addition.  It's not in the original file, but when uncommented it removes
the 1054 error message, and still no good.

Further, adding around line 340, same file, as said in my previous post all works for the products name filter:

                 if ($products_column_name == 'products_name') {
                         $products_column_name = 'pd.' . $products_column_name;
                 } // if ($products_column_name == 'products_name')

 

To fumble anywhere in this class file is certainly not the intended way as I am sure filtering specs on existing db tables fields other than products
table is implemented elsewhere in the contribution as it's a functionality PS since ever has I as far as I can see.

david

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...