Last active
December 26, 2015 16:09
-
-
Save tylerforesthauser/7177845 to your computer and use it in GitHub Desktop.
Used to grab products in an array based on a chosen Web Keyword. Currently set to use with bxSlider. List generated currently with TbThumbnails widget (I would love to use CListView, instead).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $criteria = new CDbCriteria(); | |
| $criteria->alias = 'Product'; | |
| $criteria->join='LEFT JOIN '.ProductTags::model()->tableName().' as ProductTags ON ProductTags.product_id=Product.id LEFT JOIN '.Tags::model()->tableName().' as Tags ON ProductTags.tag_id=Tags.id'; | |
| if (_xls_get_conf('INVENTORY_OUT_ALLOW_ADD') == Product::InventoryMakeDisappear) | |
| $criteria->addCondition('(inventory_avail>0 OR inventoried=0)'); | |
| if (!_xls_get_conf('CHILD_SEARCH') || empty($strQ)) | |
| $criteria->addCondition('Product.parent IS NULL'); | |
| $criteria->addCondition('web=1'); | |
| $criteria->addCondition('current=1'); | |
| $criteria->addCondition('Tags.tag=:tag'); | |
| $criteria->params = array(':tag'=>'promo'); //Chosen Web Keyword | |
| $criteria->limit = _xls_get_conf('MAX_PRODUCTS_IN_SLIDER',64); | |
| $featured = new CActiveDataProvider('Product', | |
| array( | |
| 'criteria' => $criteria, | |
| 'pagination' => array( | |
| 'pageSize' => _xls_get_conf('MAX_PRODUCTS_IN_SLIDER',64), | |
| ), | |
| ) | |
| ); | |
| ?> | |
| <?php $this->widget('zii.widgets.CListView', array( | |
| 'id'=>'prodTagged', | |
| 'dataProvider'=>$featured, | |
| 'template'=>"{items}", | |
| 'itemView'=>'_featured', | |
| 'emptyText'=>'' | |
| )); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment