本文整理汇总了PHP中Varien_Data_Collection类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Collection类的具体用法?PHP Varien_Data_Collection怎么用?PHP Varien_Data_Collection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Data_Collection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getRewriteCollection
/**
* Retrieve a collection of all rewrites
*
* @author FireGento Team <[email protected]>
* @copyright 2013 FireGento Team (http://firegento.com). All rights served.
* @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3)
*/
public function getRewriteCollection()
{
$collection = new Varien_Data_Collection();
$rewrites = $this->_loadRewrites();
foreach ($rewrites as $rewriteNodes) {
foreach ($rewriteNodes as $n) {
$nParent = $n->xpath('..');
$module = (string) $nParent[0]->getName();
$nSubParent = $nParent[0]->xpath('..');
$component = (string) $nSubParent[0]->getName();
if (!in_array($component, array('blocks', 'helpers', 'models'))) {
continue;
}
$pathNodes = $n->children();
foreach ($pathNodes as $pathNode) {
$path = (string) $pathNode->getName();
$completePath = $module . '/' . $path;
$rewriteClassName = (string) $pathNode;
$instance = Mage::getConfig()->getGroupedClassName(substr($component, 0, -1), $completePath);
$collection->addItem(new Varien_Object(array('path' => $completePath, 'rewrite_class' => $rewriteClassName, 'active_class' => $instance, 'status' => $instance == $rewriteClassName)));
}
}
}
return $collection;
}
开发者ID:Madhurabhat,项目名称:test,代码行数:32,代码来源:Data.php
示例2: getTestResultsCollection
public function getTestResultsCollection()
{
if (is_null($this->_testResultsCollection)) {
$collection = new Varien_Data_Collection();
foreach($this->_getCheckMethods() as $method => $title) {
$statusClass = 'success-msg';
try {
$response = $this->_performCheck($method);
}
catch (Exception $e) {
$response = $e->getMessage();
$statusClass = 'error-msg';
}
$collection->addItem(
new Varien_Object(array('title' => $title, 'response' => $response, 'result' => $statusClass))
);
}
$this->_testResultsCollection = $collection;
}
return $this->_testResultsCollection;
}
开发者ID:riteshsahu1981,项目名称:captainkyso,代码行数:26,代码来源:Debug.php
示例3: _prepareCollection
public function _prepareCollection()
{
/*Vamos a crear los campos que futuramente va a almacenar, pero aun no los vamos a tomar de la BBDD
* por comodidad y ver como queda y tener algunos datos de ejemplo*/
/*Creamos los datos de ejemplo*/
$thing_1 = new Varien_Object();
$thing_1->setCampaignId(1)->setNumReg(200)->setNombreLista('Lista de chicas')->setFechaCreacion('2012-03-14')->setDescripcion('Descripción de la primera lista')->setNameList('SMS_linstachicas_388232.csv');
$thing_2 = new Varien_Object();
$thing_2->setCampaignId(2);
$thing_2->setNumReg(200);
$thing_2->setNombreLista('Lista de chicos');
$thing_2->setFechaCreacion('2012-03-13');
$thing_2->setDescripcion('Descripción de la segunda lista');
$thing_2->setNameList('SMS_linstachicos_384562.csv');
$thing_3 = new Varien_Object();
$thing_3->setCampaignId(3);
$thing_3->setNumReg(200);
$thing_3->setNombreLista('Lista de compradores');
$thing_3->setFechaCreacion('2012-03-12');
$thing_3->setDescripcion('Descripción de la tercera lista');
$thing_3->setNameList('SMS_linstacompradores_198232.csv');
$collectionDemo = new Varien_Data_Collection();
$collectionDemo->addItem($thing_1)->addItem($thing_2)->addItem($thing_3);
/* Fin de los datos de ejemplo*/
$this->setCollection($collectionDemo);
return parent::_prepareCollection();
}
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:27,代码来源:Grid.php
示例4: _prepareCollection
protected function _prepareCollection()
{
$sort = $this->getParam('sort', $this->_defaultSort);
$dir = $this->getParam('dir', $this->_defaultDir);
$files = $this->_helper->getLogFiles();
if (isset($sort) && !empty($files) && isset($files[0][$sort])) {
usort($files, function ($a, $b) use($sort, $dir) {
$a = $a[$sort];
$b = $b[$sort];
if (is_numeric($a)) {
return $dir == 'asc' ? $a - $b : $b - $a;
} else {
return $dir == 'asc' ? strcmp($a, $b) : -strcmp($a, $b);
}
});
}
$collection = new Varien_Data_Collection();
foreach ($files as $file) {
$item = new Varien_Object();
$item->setIdFieldName('filename');
$item->setFilename($file['filename']);
$item->setFilesize($this->_helper->humanFilesize($file['filesize']));
$item->setLines($file['lines']);
$collection->addItem($item);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
开发者ID:cewolf2002,项目名称:magento,代码行数:28,代码来源:Grid.php
示例5: _apply
/**
* Apply the Vimeo short code
*
* @param string &$content
* @param Fishpig_Wordpress_Model_Post_Abstract $object
* @return void
*/
protected function _apply(&$content, Fishpig_Wordpress_Model_Post_Abstract $object)
{
if (($shortcodes = $this->_getShortcodes($content)) !== false) {
foreach ($shortcodes as $it => $shortcode) {
$args = $shortcode->getParams();
if (!$args->getColumns()) {
$args->setColumns(3);
}
if (!$args->getSize()) {
$args->setSize('thumbnail');
}
if (!$args->getLink()) {
$args->setLink('attachment');
}
if ($args->getPostId()) {
if ($args->getPostId() !== $params['object']->getId()) {
$post = Mage::getModel('catalog/post')->load($args->getPostId());
}
}
if (($ids = trim($args->getIds(), ',')) !== '') {
$images = new Varien_Data_Collection();
foreach (explode(',', $ids) as $imageId) {
$image = Mage::getModel('wordpress/image')->load($imageId);
if ($image->getId()) {
$images->addItem($image);
}
}
} else {
$images = $object->getImages();
}
$html = $this->_createBlock('wordpress/template')->setImageCollection($images)->setColumns($args->getColumns())->setPost($object)->setSize($args->getSize())->setLink($args->getLink())->setGalleryIt($it + 1)->setTemplate('wordpress/shortcode/gallery.phtml')->setAfterGalleryScript(Mage::helper('wp_addon_lightboxgallery')->getAfterGalleryScript($it + 1))->toHtml();
$content = str_replace($shortcode->getHtml(), $html, $content);
}
}
}
开发者ID:LiamMcArthur,项目名称:extension-fishpig-wordpress-integration,代码行数:42,代码来源:Gallery.php
示例6: _prepareCollection
protected function _prepareCollection()
{
// Build a collection representing each data feed for each website
$collection = new Varien_Data_Collection();
// Iterate websites and check configuration
$websites = Mage::app()->getWebsites(false, true);
foreach ($websites as $website) {
// Grab id from website
$websiteId = $website->getId();
// Create Website Row in Grid
if (Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/general/allfeedsenabled') == 'enabled') {
// Lookup configuration for this site
$feedTypes = '';
foreach (Mybuys_Connector_Model_Generatefeeds::getFeedTypes() as $curFeedType) {
if (Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/feedsenabled/' . $curFeedType) == 'enabled') {
if (strlen($feedTypes) > 0) {
$feedTypes .= ', ';
}
$feedTypes .= $curFeedType;
}
}
$sftpUser = Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/connect/username');
$sftpDestination = Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/connect/hostname');
// Create and save grid item
$newItem = $collection->getNewEmptyItem();
$newItem->setData(array('id' => $website->getId(), 'website_name' => $website->getName(), 'website_code' => $website->getCode(), 'feeds' => $feedTypes, 'sftp_destination' => $sftpDestination, 'sftp_user' => $sftpUser));
$collection->addItem($newItem);
}
}
$this->setCollection($collection);
return $this;
}
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:32,代码来源:Grid.php
示例7: _prepareColumns
protected function _prepareColumns()
{
try {
$collection = $this->_createCollection();
$collection->setPageSize(1);
$collection->load();
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occured rendering the grid: ' . $e->getMessage()));
Mage::logException($e);
$collection = new Varien_Data_Collection();
}
$config = $this->_getReport()->getGridConfig();
$filterable = $config->getFilterable();
$items = $collection->getItems();
if (count($items)) {
$item = reset($items);
foreach ($item->getData() as $key => $val) {
$isFilterable = false;
if (isset($filterable[$key])) {
$isFilterable = $filterable[$key];
} elseif (in_array($key, $filterable)) {
$isFilterable = 'adminhtml/widget_grid_column_filter_text';
}
$this->addColumn($key, array('header' => Mage::helper('core')->__($key), 'index' => $key, 'filter' => $isFilterable, 'sortable' => true));
}
}
return parent::_prepareColumns();
}
开发者ID:jeo4long,项目名称:custom-reports,代码行数:28,代码来源:Grid.php
示例8: getGalleryImages
public function getGalleryImages()
{
if ($this->_all === null) {
if (class_exists('FlintDigital_SimpleProductData_Block_Product_View_Media')) {
$block = new FlintDigital_SimpleProductData_Block_Product_View_Media();
$collection = $block->getGalleryImages();
} else {
$collection = parent::getGalleryImages();
}
if (empty($collection) || $collection->getSize() == 0) {
$productMediaConfig = Mage::getModel('catalog/product_media_config');
$image = $this->getProduct()->getImage();
if ($image != 'no_selection') {
$img['url'] = $productMediaConfig->getMediaUrl($image);
$img['id'] = null;
$img['path'] = $productMediaConfig->getMediaPath($image);
$collection = new Varien_Data_Collection();
$collection->addItem(new Varien_Object($img));
}
}
$videosInit = new IWD_Productvideo_Block_Frontend_Init();
$this->_all = new Varien_Data_Collection();
if ($videosInit->getThumbnailsPosition() == 'before') {
$this->_completeCollectionWithVideo();
}
foreach ($collection as $item) {
$this->_all->addItem($item);
}
if ($videosInit->getThumbnailsPosition() == 'after') {
$this->_completeCollectionWithVideo();
}
}
return $this->_all;
}
开发者ID:flintdigital,项目名称:mage-mod-product-videos-iwd,代码行数:34,代码来源:Media.php
示例9: listing
/**
* List all Cache types
*
* @return MageHack_MageConsole_Model_Abstract
*/
public function listing()
{
$collection = new Varien_Data_Collection();
foreach (Mage::app()->getCacheInstance()->getTypes() as $type) {
$collection->addItem($type);
}
if (!$collection->count()) {
$message = 'This is strange, we did not find any cache types.';
$this->setType(self::RESPONSE_TYPE_MESSAGE);
$this->setMessage($message);
} else {
if ($collection->count() > 0) {
$values = $collection->toArray();
if (is_array($values) && $values['totalRecords'] > 0) {
foreach ($values['items'] as $row) {
if (is_array($row)) {
$_values[] = array_intersect_key($row, $this->_attrToShow);
}
}
if (Mage::getStoreConfig('admin/mageconsole/html_tables') != 1) {
$this->setType(self::RESPONSE_TYPE_MESSAGE);
$message = Mage::helper('mageconsole')->createTable($_values, true, $this->_columnWidths);
$this->setMessage($message);
} else {
$this->setMessage($_values);
$this->setType(self::RESPONSE_TYPE_LIST);
}
}
}
}
return $this;
}
开发者ID:keywork,项目名称:MageConsole,代码行数:37,代码来源:Cache.php
示例10: _prepareCollection
/**
* Prepare grid collection
*/
protected function _prepareCollection()
{
$collection = new Varien_Data_Collection();
$layout = $this->getLayout();
$update = $layout->getUpdate();
$design = Mage::getSingleton('core/design_package');
$layoutXML = $update->getFileLayoutUpdatesXml('frontend', $design->getPackageName(), $design->getTheme('layout'), 0);
$xpath = $layoutXML->xpath('//action[@method="setEsi"]');
foreach ($xpath as $x) {
$esi = new Varien_Object();
$handle = $x->xpath('ancestor::node()[last()-2]');
$handleName = $handle[0]->label ? $handle[0]->label : $handle[0]->getName();
$parentBlock = $x->xpath('parent::*');
$parentBlockName = $parentBlock[0]->getAttribute('name');
$parentBlockDescription = $parentBlock[0]->getAttribute('description');
$cacheType = $x->params->cache_type ? $x->params->cache_type : "global";
$esi->setId($parentBlockName);
$esi->setHandle($handleName);
$esi->setBlockName($parentBlockName);
$esi->setDescription($parentBlockDescription);
$esi->setCacheType($cacheType);
try {
$collection->addItem($esi);
} catch (Exception $e) {
Mage::logException($e);
}
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
开发者ID:mwin007,项目名称:Magento-Varnish,代码行数:33,代码来源:Grid.php
示例11: __construct
public function __construct()
{
parent::__construct();
$this->setTemplate('order-approval/cart.phtml');
$approverId = Mage::getSingleton('customer/session')->getCustomer()->getId();
$groups = Mage::getResourceModel('customer/group_collection')->addFieldToFilter('approver_id', $approverId)->load();
$_customers = array();
foreach ($groups as $group) {
$_customers += Mage::getResourceModel('customer/customer_collection')->addNameToSelect()->addAttributeToFilter('group_id', $group->getId())->getItems();
}
$_customers += Mage::getResourceModel('customer/customer_collection')->addNameToSelect()->addAttributeToFilter('approver', $approverId)->getItems();
$customers = new Varien_Data_Collection();
foreach ($_customers as $customer) {
$quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getStore()->getId())->loadByCustomer($customer->getId());
$declinedItems = Mage::getModel('sales/quote_item')->getCollection()->addFieldToFilter('approved', 2)->setQuote($quote);
$approvedItems = Mage::getModel('sales/quote_item')->getCollection()->addFieldToFilter('approved', 1)->setQuote($quote);
$unapprovedItemsNumber = count($quote->getItemsCollection()) - count($approvedItems) - count($declinedItems);
if ($unapprovedItemsNumber) {
$customer->setUnapprovedItemsNumber($unapprovedItemsNumber);
$customers->addItem($customer);
}
}
$this->setCustomers($customers);
Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('orderapproval')->__('Carts of customers'));
}
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:25,代码来源:Customercart.php
示例12: processGroup
public function processGroup($collection)
{
$items = null;
if ($collection && $collection->getSize() > 0) {
$items = new Varien_Data_Collection();
//$items->clear();
$_groupId = 0;
$_item = null;
$_groupItem = array();
$_groupQty = array();
foreach ($collection as $item) {
$product = Mage::getModel('catalog/product')->load($item->getProductId());
$_groupItem = array('product_name' => $product->getName(), 'product_id' => $item->getProductId(), 'sku' => $item->getSku(), 'product_qty' => $item->getQty(), 'product_qty_invoiced' => $item->getQtyInvoiced(), 'product_qty_shipped' => $item->getQtyShipped(), 'product_qty_refunded' => $item->getQtyRefunded(), 'price' => $item->getPrice(), 'wrap_id' => $item->getId());
$_groupItem = $this->_appendItem($_groupItem, $item);
if ($_groupId != $item->getGroupId()) {
$_item = clone $item;
$_groupId = $item->getGroupId();
$_item->setGroupItem(array($_groupItem));
$items->addItem($_item);
} else {
$_groupItem = $_item->getGroupItem();
$_groupItem[] = $_groupItem;
$_item->setGroupItem($_groupItem);
}
}
}
return $items;
}
开发者ID:hoadaithieu,项目名称:mage-giftwrap,代码行数:28,代码来源:Wrap.php
示例13: getSearchResultCollection
private function getSearchResultCollection()
{
$collection = new Varien_Data_Collection();
$index = Mage::helper('searchindex/index')->getIndex('mage_catalog_product');
$storeId = $this->getStoreId();
if (($query = $this->getRequest()->getParam('q')) && $index) {
$engine = Mage::helper('searchindex')->getSearchEngine();
$start = microtime(true);
try {
$result = $engine->query($query, $storeId, $index);
} catch (Exception $e) {
try {
$engine = Mage::getModel('searchsphinx/engine_fulltext');
$result = $engine->query($query, $storeId, $index);
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
$result = array();
}
}
$end = microtime(true);
$this->searchTime = round($end - $start, 4);
foreach ($result as $productId => $relevance) {
$varienObject = new Varien_Object();
$varienObject->addData(array('id' => $productId, 'relevance' => $relevance));
$collection->addItem($varienObject);
}
$this->resultSize = $collection->getSize();
}
return $collection;
}
开发者ID:AleksNesh,项目名称:pandora,代码行数:30,代码来源:Speed.php
示例14: _prepareCollection
/**
* Collection object set up
*/
protected function _prepareCollection()
{
$collection = new Varien_Data_Collection();
foreach (Mage_Api2_Model_Auth_User::getUserTypes() as $type => $label) {
$collection->addItem(new Varien_Object(array('user_type_name' => $label, 'user_type_code' => $type)));
}
$this->setCollection($collection);
}
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:11,代码来源:Grid.php
示例15: _prepareCollection
/**
* Prepare grid collection
*/
protected function _prepareCollection()
{
$collection = new Varien_Data_Collection();
foreach (Mage::app()->getCacheInstance()->getTypes() as $type) {
$collection->addItem($type);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:12,代码来源:Grid.php
示例16: _getTestCollection
/**
* Retrieve test collection
*
* @return Varien_Data_Collection
*/
protected function _getTestCollection()
{
$collection = new Varien_Data_Collection();
$items = array(new Varien_Object(array('test1' => '1', 'test2' => '2')));
foreach ($items as $item) {
$collection->addItem($item);
}
return $collection;
}
开发者ID:nickimproove,项目名称:magento2,代码行数:14,代码来源:TotalsAbstractTest.php
示例17: _processPeriod
private function _processPeriod($collection, $period)
{
switch ($period) {
case 'day':
return $collection;
break;
case 'month':
$index = 1;
break;
case 'year':
$index = 0;
break;
}
$fields = array('abandoned_carts_num', 'abandoned_carts_price', 'abandoned_items_num', 'recovered_carts_num', 'ordered_carts_num', 'ordered_carts_price', 'ordered_items_num', 'av_back_time', 'target_letter_step');
$date = $collection->getFirstItem()->getDate();
$dateArray = explode('-', $date);
$val = $dateArray[$index];
$returnCollection = new Varien_Data_Collection();
$object = new Varien_Object();
//$counterABT=0;
$counterTLS = 0;
foreach ($collection as $item) {
$dateArray = explode('-', $item->getDate());
if ($dateArray[$index] != $val) {
$val = $dateArray[$index];
/*if($counterABT)
{
$object->setData('av_back_time',$object->getData('av_back_time')/$counterABT);
}*/
if ($counterTLS) {
$object->setData('target_letter_step', $object->getData('target_letter_step') / $counterTLS);
}
$returnCollection->addItem($object);
$object = new Varien_Object();
$counterABT = 0;
$counterTLS = 0;
}
$object->setDate($item->getDate());
//if($item->getData('av_back_time'))$counterABT++;
if ($item->getData('target_letter_step')) {
$counterTLS++;
}
foreach ($fields as $field) {
$object->setData($field, $object->getData($field) + $item->getData($field));
}
}
/*if($counterABT)
{
$object->setData('av_back_time',$object->getData('av_back_time')/$counterABT);
}*/
if ($counterTLS) {
$object->setData('target_letter_step', $object->getData('target_letter_step') / $counterTLS);
}
$returnCollection->addItem($object);
return $returnCollection;
}
开发者ID:rajarshc,项目名称:Rooja,代码行数:56,代码来源:Grid.php
示例18: getVarienDataCollection
/**
* Returns Varien data collection
*
* @param array $items
*
* @return Varien_Data_Collection
*/
public function getVarienDataCollection($items)
{
$collection = new Varien_Data_Collection();
foreach ($items as $item) {
$_Varien = new Varien_Object();
$_Varien->setData($item);
$collection->addItem($_Varien);
}
return $collection;
}
开发者ID:2007lf,项目名称:magento-integration,代码行数:17,代码来源:Authentication.php
示例19: _getInvoiceCollection
/**
* Retrieve new invoice collection from an array of invoices' data
*
* @param array $invoicesData
* @return Varien_Data_Collection
*/
protected function _getInvoiceCollection(array $invoicesData)
{
$result = new Varien_Data_Collection();
foreach ($invoicesData as $oneInvoiceData) {
/** @var $prevInvoice Mage_Sales_Model_Order_Invoice */
$prevInvoice = $this->getMock('Mage_Sales_Model_Order_Invoice', array('_init'), array($oneInvoiceData));
$result->addItem($prevInvoice);
}
return $result;
}
开发者ID:nayanchamp,项目名称:magento2,代码行数:16,代码来源:ShippingTest.php
示例20: _prepareCollection
/**
* Prepare collection for grid
*
* @return Mage_Adminhtml_Block_Widget_Grid
*/
protected function _prepareCollection()
{
$collection = new Varien_Data_Collection();
foreach ($this->getTransactionAdditionalInfo() as $key => $value) {
$data = new Varien_Object(array('key' => $key, 'value' => $value));
$collection->addItem($data);
}
$this->setCollection($collection);
return parent::_prepareCollection();
}
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:15,代码来源:Grid.php
注:本文中的Varien_Data_Collection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论