Jump to content

Edit History

Matt E

Matt E

I would like to add the product reference before the name of each product when creating new order on back-end where the arrow is in this screenshot...

product-search.jpg.63836e60931ff4453b4a50f342c5a168.jpg

I have found searchProductsAction function in "PrestaShopBundle\Controller\Admin\Sell\Order\OrderController" which uses SearchProducts and FoundProduct controllers located here:

use PrestaShop\PrestaShop\Core\Domain\Product\Query\SearchProducts;
use PrestaShop\PrestaShop\Core\Domain\Product\QueryResult\FoundProduct;

Also, I see these results are assembled by the admin\themes\new-theme\public\order_create.bundle.js script using the $name attribute of the $foundProducts array from an AJAX call.

As an experiment, I was able to change what was displayed in the results list by modifying the $name variable in the FoundProduct.php core controller, like this:

product-search2.jpg.1a18d51354fd9b8457232c914897af35.jpg

However this file does not declare the $reference variable like it does in the nearby ProductDetails.php controller. In fact, trying to declare and return any other variable in FoundProduct.php results in a 500 error when performing the search function.

I was able to succsesfully remap the admin_orders_products_search route to a custom controller to override the searchProductsAction function, but I am stuck on how to correctly modify the $name attribute to include the $reference for each $foundProduct before returning it to the order_create.bundle.js script to display the results, and do so using an override instead of actually editing the core controller file.

Can someone more experienced please advise the correct procedure to achieve this?

Matt E

Matt E

I would like to add the product reference before the name of each product when creating new order on back-end where the arrow is in this screenshot...

product-search.jpg.63836e60931ff4453b4a50f342c5a168.jpg

I have found searchProductsAction function in "PrestaShopBundle\Controller\Admin\Sell\Order\OrderController" which uses SearchProducts and FoundProduct controllers located here:

use PrestaShop\PrestaShop\Core\Domain\Product\Query\SearchProducts;
use PrestaShop\PrestaShop\Core\Domain\Product\QueryResult\FoundProduct;

Also, I see these results are assembled by the admin\themes\new-theme\public\order_create.bundle.js script using the $name attribute of the $foundProducts array from an AJAX call.

As an experiment, I was able to change what was displayed in the results list by modifying the $name variable in the FoundProduct.php core controller, like this:

product-search2.jpg.1a18d51354fd9b8457232c914897af35.jpg

However this file does not declare the $reference variable like it does in the nearby ProductDetails.php controller. In fact, trying to declare and return any other variable in FoundProduct.php results in a 500 error when performing the search function.

I was able to succsesfully remap the admin_orders_products_search route to a custom controller to override the searchProductsAction function, but I am stuck on how to modify the $name attribute for each $foundProduct before returning it to the order_create.bundle.js script to display the results.

Can someone more experienced please advise the correct procedure to achieve this?

Matt E

Matt E

I would like to add the product reference before the name of each product when creating new order on back-end where the arrow is in this screenshot...

product-search.jpg.63836e60931ff4453b4a50f342c5a168.jpg

I have found searchProductsAction function in "PrestaShopBundle\Controller\Admin\Sell\Order\OrderController" which uses SearchProducts and FoundProduct controllers located here:

use PrestaShop\PrestaShop\Core\Domain\Product\Query\SearchProducts;
use PrestaShop\PrestaShop\Core\Domain\Product\QueryResult\FoundProduct;

Also, I see these results are assembled by the admin\themes\new-theme\public\order_create.bundle.js script using the $name attribute of the $foundProducts array from an AJAX call.

As an experiment, I was able to change what was displayed in the results list by modifying the $name variable in the FoundProduct.php core controller, but this file does not declare the $reference variable like it does in the nearby ProductDetails.php controller. In fact, trying to declare and return any other variable in FoundProduct.php results in a 500 error when performing the search function.

I was able to succsesfully remap the admin_orders_products_search route to a custom controller to override the searchProductsAction function, but I am stuck on how to modify the $name attribute for each $foundProduct before returning it to the order_create.bundle.js script to display the results.

Can someone more experienced please advise the correct procedure to achieve this?

×
×
  • Create New...