User Tools

Site Tools


koding:hostcms:shop:notnullmodifications

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

koding:hostcms:shop:notnullmodifications [06.05.15 в 18:39]
Артем Куц создано
— (current)
Line 1: Line 1:
-<​code><?​php 
  
- ​defined('​HOSTCMS'​) || exit('​HostCMS:​ access denied.'​);​ 
- 
-/** 
-* Запрет на добавление модификаций с нулевым количеством 
- 
-* @author Kuts Artem, KAD Systems (©) 2014  
-* @date 28-11-2014  
-  
-Core_Event::​attach('​shop_item.onBeforeShowXmlModifications',​ array('​Kad_Shop_Item_Observers_Notnullmodifications',​ '​onBeforeShowXmlModifications'​));​ 
-  
- */ 
- 
- class Kad_Shop_Item_Observers_Notnullmodifications 
- { 
- static public function onBeforeShowXmlModifications($oItem,​ $aParams) 
-    { 
- 
- if (isset($aParams[0])) 
- { 
- $oModifications = $aParams[0];​ 
-  
- $oModifications->​queryBuilder() 
- ->​select('​shop_items.*'​) 
- ->​leftJoin('​shop_warehouse_items',​ '​shop_warehouse_items.shop_item_id',​ '​=',​ '​shop_items.id'​) 
- ->​having('​SUM(shop_warehouse_items.count)',​ '>',​ 0) 
- ->​groupBy('​shop_items.id'​);​ 
- } 
- } 
-}</​code>​ 
koding/hostcms/shop/notnullmodifications.1430926743.txt.gz · Last modified: 26.06.15 в 15:07 (external edit)