Исправления

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2021-04-25 20:09:39 +10:00
parent 0a8c74a9a3
commit 85e3d5f1bd
2 changed files with 9 additions and 2 deletions

View File

@ -77,7 +77,7 @@ $config = [
'controller' => 'main'
],
'product/<catn:[^/]+>' => 'product/index',
'product/<catn:[^/]+>/<action:(write|edit|delete)>/<target:(title|catn|dscr|dmns|wght|image|cover)>' => 'product/<action>-<target>',
'<section:(product|cart)>/<catn:[^/]+>/<action:(write|edit|delete)>/<target:(title|catn|dscr|dmns|wght|image|cover|comm)>' => '<section>/<action>-<target>',
'orders' => 'order/index'
],
],

View File

@ -45,15 +45,22 @@ class OrderEdgeSupply extends Edge
* Поиск поставки по артикулу
*
* @param string $catn Артикул
* @param Order $order Заказ
* @param int $limit Максимальное количество
*
* @return array Поставки
*/
public static function searchBySupplyCatn(string $catn, int $limit = 10): array
public static function searchBySupplyCatn(string $catn, Order $order = null, int $limit = 10): array
{
if ($supply = Supply::searchByCatn($catn, 1)) {
// Поставка найдена
if (isset($order)) {
// Поиск только по определённому заказу
return self::find()->where(['_from' => $order->readId(), '_to' => $supply->readId()])->limit($limit)->all();
}
return self::find()->where(['_to' => $supply->readId()])->limit($limit)->all();
}