View Single Post
  #2  
Old 05-07-2021, 05:13 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,041
 

Default Re: How to link out-of-stock or low-stock items to admin end?

You can decorate classes/XLite/View/Product/MailBox.php class and modify

Code:
protected function getDefaultProductURLProcessor() { return function (Product $product) { return $this->buildFullURL('product', '', ['product_id' => $product->getId()]); }; }


or


Code:
protected function getProductURL() { $closure = $this->getProductURLProcessor(); return $closure($this->getProduct()); }


to return admin side url for the product. The way this is now it will almost always return the storefront url because the warning is usually called from the storefront due to product getting low stock after order placement.


You can decorate the getProductURL like this


Code:
/** * @return string */ protected function getProductURL() { return \XLite\Core\Converter::buildFullURL($target, $action, $params, \XLite::getAdminScript(), fasle, false); }


This is untested
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote