0

I am facing an issue after re-indexing not able to add or edit product and old products are not showing.

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ) ) AND (p.entity_id = '2112') LIMIT 1' at line 3, query was: SELECT DISTINCT p.entity_id FROM catalog_product_entity AS p INNER JOIN catalog_product_flat_1 AS cpf ON cpf.entity_id = p.entity_id LEFT JOIN catalog_category_product AS ccp ON ccp.product_id = p.entity_id WHERE ( ( (cpf.attribute_set_id='4' AND ) ) ) AND (p.entity_id = '2112') LIMIT 1

AND is 2 times, but it comes from magento core before when i didn't do re-indexing i can do edit and update there is no SQL error but after re-indexing its appears.

I Checked all the necessary things like (Status,Visibility,Qty ,Stock Availability,Product Categories,Indexes and Caches), but i am not able to add or even edit old products, or not able to view on fronted any product on detail page..

app\code\core\Mage\Rule\Model\Resource\Abstract.php

public function getProductFlatSelect($storeId, $condition)
{
    $select = $this->_getReadAdapter()->select();
    $select->from(
            array('p' => $this->getTable('catalog/product')),
            array(new Zend_Db_Expr('DISTINCT p.entity_id'))
        )
        ->joinInner(
            array('cpf' => $this->getTable('catalog/product_flat') . '_' . $storeId),
            'cpf.entity_id = p.entity_id',
            array()
        )->joinLeft(
            array('ccp' => $this->getTable('catalog/category_product')),
            'ccp.product_id = p.entity_id',
            array()
        );

    $where = $condition->prepareConditionSql();
    if (!empty($where)) {
        $select->where($where);
    }

    return $select;
}
4
  • Please try with disabled flat option in configuration. Jun 19, 2019 at 9:22
  • Hi Anas, Thanks, My half issue resolve by your suggestion now I can Edit or update product.. but I can't see Product custom option on frontend... Jun 19, 2019 at 21:34
  • Please check with admin panel it's exist or not. Jun 20, 2019 at 0:16
  • All Product are exist, even i get the name of the product on detail page but not able to see Product Options... Jun 20, 2019 at 12:01

1 Answer 1

1

The query has the syntax error because some of the catalog rule conditions are incomplete: https://prnt.sc/xnf5zo When the flat catalog is enabled the query checks also the catalog rules. You should check all your rules and edit the conditions to solve the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.