User Tools

Site Tools


koding:hostcms:shop:notnullmodifications

This is an old revision of the document!


<?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');
		}
	}
}
koding/hostcms/shop/notnullmodifications.1430926743.txt.gz · Last modified: 26.06.15 в 15:07 (external edit)