Post by nongetjie » Tue Nov 08, 2016 3:57 pm

I have a really weird situation with OC 1.5.6 which I haven't been able to solve.

Sometimes the related products I have added to a product seem to dissappear after a new edit on the product. A dump of the variable of related products taught me that the product_id of the products is NULL in the array, the product name DOES get found.

The product id and name of related products are fetched by the getProducts function, which has the following query

Code: Select all

SELECT DISTINCT *, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id . "') AS keyword FROM " . DB_PREFIX . "product p LEFT JOIN " . DB_PREFIX . "product_description pd ON (p.product_id = pd.product_id) WHERE p.product_id = '" . (int)$product_id . "' AND pd.language_id = '" . (int)$this->config->get('config_language_id') . "'"
now this query does not seem to be in very good order, for example the distinct looks not in the correct place to me, and product_id is ambiguous (both in product and product_description, so gets returned twice) With multilanguage turned on the subquery returns more rows, I also get this error when running the query directly on the db.

Now what I have found is that I have this problem ONLY with products I have imported with an import script. Products manually added to the store don't have this problem. So my conclusion would be that I forget to add some information to a table on the import. But the weird part is that all the information for the getProducts query is there, but it just returns NULL for product_id.

Any ideas?

New member

Posts

Joined
Wed Nov 07, 2012 8:28 pm
Who is online

Users browsing this forum: No registered users and 58 guests