OpenCart City 0 Posted December 29, 2020 Posted December 29, 2020 Hello, We are trying to create controller in admin side and created successfully. We have added below code to get the product fields: $this->_select .= 'sa.quantity'; $this->_join = 'LEFT JOIN ' . _DB_PREFIX_ . 'stock_available sa ON (a.id_product = sa.id_product)'; $this->fields_list = array( 'id_product' => array( 'title' => $this->l('PrestaShop Product ID'), ), 'quantity' => array( 'title' => $this->l('Quantity') ), ); But when we try to filter by quantity then getting the error "Column 'quantity' in where clause is ambiguous". We know the reason of this error. The reason is quantity field is present in both product and stock_available tables. So please let us know the solution. Thanks! Share this post Link to post Share on other sites
PhpMadman 105 Posted December 29, 2020 Posted December 29, 2020 If i remember correctly it is because your fields_list asks for quantity, and as you said, it matches both fields You can either change it to a.quantity or sa.quantity Or you can edit your select _select to 'sa.quantity AS qty' and change fields_list from quantity to qty. Assuming you want the quantity from stock_available Share this post Link to post Share on other sites
OpenCart City 0 Posted December 30, 2020 Posted December 30, 2020 Hello, Thank you for your response. We have tried both the solutions but didn't worked for us. 1. When we change the quantity in $this->fields_list as a.quantity or sa.quantity, it is not displaying any quantity. We are getting only -- in this column. 2. When we add sa.quantity AS qty and change fields_list from quantity to qty it is giving the error "Unknown column 'qty' in 'where clause'". So please check and provide some solution. Thanks! Share this post Link to post Share on other sites
OpenCart City 0 Posted January 28 Posted January 28 Hello, Is there any solution? Thanks! Share this post Link to post Share on other sites
OpenCart City 0 Posted January 31 Posted January 31 Hello, Is there anyone who can help us to solve the issue? Thanks! Share this post Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now