本文整理汇总了PHP中Mage_Catalog_Model_Category::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Category::getData方法的具体用法?PHP Mage_Catalog_Model_Category::getData怎么用?PHP Mage_Catalog_Model_Category::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Category
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Category::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFotoliaCategoryParams
public function getFotoliaCategoryParams(Mage_Catalog_Model_Category $category)
{
$this->_fotoliaCategory1Id = $category->getFotoliaCategory1Id();
$this->_fotoliaCategory2Id = $category->getFotoliaCategory2Id();
$this->_fotoliaSearchQuery = $category->getFotoliaSearchQuery();
$this->_fotoliaContentType = Mage::getSingleton('eav/config')->getAttribute('catalog_category', 'fotolia_content_type')->getSource()->getOptionText($category->getData('fotolia_content_type'));
$this->_fotoliaWithPeople = Mage::getSingleton('eav/config')->getAttribute('catalog_category', 'fotolia_with_people')->getSource()->getOptionText($category->getData('fotolia_with_people'));
$this->_fotoliaOrientation = Mage::getSingleton('eav/config')->getAttribute('catalog_category', 'fotolia_orientation')->getSource()->getOptionText($category->getData('fotolia_orientation'));
$this->_fotoliaIsolated = Mage::getSingleton('eav/config')->getAttribute('catalog_category', 'fotolia_isolated')->getSource()->getOptionText($category->getData('fotolia_isolated'));
$this->_fotoliaColors = $category->getFotoliaColors();
$this->_fotoliaGalleryId = false;
//todo
$this->_fotoliaIdsList = $category->getFotoliaIdsList();
}
示例2: testSaveAction
/**
* @magentoDataFixture Mage/Core/_files/store.php
* @magentoDbIsolation enabled
* @dataProvider saveActionDataProvider
* @param array $inputData
* @param array $defaultAttributes
* @param array $attributesSaved
*/
public function testSaveAction($inputData, $defaultAttributes, $attributesSaved = array())
{
$store = new Mage_Core_Model_Store();
$store->load('fixturestore', 'code');
$storeId = $store->getId();
$this->getRequest()->setPost($inputData);
$this->getRequest()->setParam('store', $storeId);
$this->getRequest()->setParam('id', 2);
$this->dispatch('backend/admin/catalog_category/save');
$messages = Mage::getSingleton('Mage_Backend_Model_Session')->getMessages(false)->getItemsByType(Mage_Core_Model_Message::SUCCESS);
$this->assertNotEmpty($messages, "Could not save category");
$this->assertEquals('The category has been saved.', current($messages)->getCode());
$category = new Mage_Catalog_Model_Category();
$category->setStoreId($storeId);
$category->load(2);
$errors = array();
foreach ($attributesSaved as $attribute => $value) {
$actualValue = $category->getData($attribute);
if ($value !== $actualValue) {
$errors[] = "value for '{$attribute}' attribute must be '{$value}', but '{$actualValue}' is found instead";
}
}
foreach ($defaultAttributes as $attribute => $exists) {
if ($exists !== $category->getExistsStoreValueFlag($attribute)) {
if ($exists) {
$errors[] = "custom value for '{$attribute}' attribute is not found";
} else {
$errors[] = "custom value for '{$attribute}' attribute is found, but default one must be used";
}
}
}
$this->assertEmpty($errors, "\n" . join("\n", $errors));
}
示例3: getCategoryUrl
/**
* Retrieve category url
*
* @param Mage_Catalog_Model_Category $category
* @return string
*/
public function getCategoryUrl($category)
{
if ($category instanceof Mage_Catalog_Model_Category) {
return $category->getUrl();
}
return Mage::getModel('catalog/category')->setData($category->getData())->getUrl();
}
示例4: _hasCustomUpdate
protected function _hasCustomUpdate(Mage_Catalog_Model_Category $category)
{
if ($category->getData('custom_layout_update') && in_array($category->getCustomDesignApply(), array(Mage_Catalog_Model_Design::CATEGORY_APPLY_CATEGORY_AND_PRODUCT_RECURSIVE, Mage_Catalog_Model_Design::CATEGORY_APPLY_CATEGORY_RECURSIVE))) {
return true;
}
return false;
}
示例5: getCategoryUrl
/**
* Get url for category data
*
* @param Mage_Catalog_Model_Category $category
* @return string
*/
public function getCategoryUrl($category)
{
if ($category instanceof Mage_Catalog_Model_Category) {
$url = $category->getUrl();
} else {
$url = $this->_getCategoryInstance()->setData($category->getData())->getUrl();
}
return $url;
}
示例6: _isCategoryClickAble
/**
* Check if click able enabled for category.
*
* @param Varien_Data_Tree_Node|Mage_Catalog_Model_Category $category
* @return bool
*/
protected function _isCategoryClickAble($category)
{
$isCategoryClickAbleStatus = true;
$isCategoryClickAble = $category->getData(Monsoon_Test_Helper_Data::IS_CLICK_ABLE_LINK_CODE);
if ($isCategoryClickAble !== null && (bool) $isCategoryClickAble === false) {
$isCategoryClickAbleStatus = false;
}
return $isCategoryClickAbleStatus;
}
示例7: getCategoryUrl
/**
* Retrieve Url for specified category
*
* @param Mage_Catalog_Model_Category $category
* @return string
*/
public function getCategoryUrl(Mage_Catalog_Model_Category $category)
{
$url = $category->getData('url');
if (null !== $url) {
return $url;
}
Varien_Profiler::start('REWRITE: ' . __METHOD__);
if ($category->hasData('request_path') && $category->getData('request_path') != '') {
$category->setData('url', $this->_getDirectUrl($category));
Varien_Profiler::stop('REWRITE: ' . __METHOD__);
return $category->getData('url');
}
$requestPath = $this->_getRequestPath($category);
if ($requestPath) {
$category->setRequestPath($requestPath);
$category->setData('url', $this->_getDirectUrl($category));
Varien_Profiler::stop('REWRITE: ' . __METHOD__);
return $category->getData('url');
}
Varien_Profiler::stop('REWRITE: ' . __METHOD__);
$category->setData('url', $category->getCategoryIdUrl());
return $category->getData('url');
}
示例8: beforeSave
/**
* Format url_key value
*
* @param Mage_Catalog_Model_Category $object
* @return Mage_Catalog_Model_Category_Attribute_Backend_Urlkey
*/
public function beforeSave($object)
{
$attributeName = $this->getAttribute()->getName();
$urlKey = $object->getData($attributeName);
if ($urlKey === false) {
return $this;
}
if ($urlKey == '') {
$urlKey = $object->getName();
}
if (empty($urlKey)) {
$urlKey = Mage::helper('core')->uniqHash();
}
$object->setData($attributeName, $object->formatUrlKey($urlKey));
$this->_validateEntityUrl($object);
return $this;
}
示例9: afterLoad
/**
* Unserializes the virtual category configuration after it has been loaded.
*
* @param Mage_Catalog_Model_Category $object Category saved.
*
* @return Smile_VirtualCategories_Model_Category_Attributes_Backend_Virtual
*/
public function afterLoad($object)
{
$attributeCode = $this->getAttribute()->getName();
$data = $object->getData($attributeCode);
if ($data && is_string($data) && strlen($data)) {
$data = unserialize($data);
} else {
$data = $this->_defaultValue;
}
$virtualCategoryRule = Mage::getModel('smile_virtualcategories/rule');
if (isset($data['rule_serialized'])) {
$virtualCategoryRule->getConditions()->setConditions(array())->loadArray($data['rule_serialized']);
}
$virtualCategoryRule->setCategory($object);
$object->setData('is_virtual', $data['is_virtual']);
$object->setData('virtual_rule', $virtualCategoryRule);
return $this;
}
示例10: beforeSave
/**
* @param Mage_Catalog_Model_Category $object
* @return $this|Convenient_CategoryCode_Model_Attribute_Backend_Code
*
* @author Luke Rodgers <lukerodgers90@gmail.com>
*/
public function beforeSave($object)
{
$attributeName = $this->getAttribute()->getName();
$code = $object->getData($attributeName);
if ($code === false) {
return $this;
}
if ($code == '') {
$code = array();
$parents = $object->getParentCategories();
foreach ($parents as $parent) {
if ($parent->getLevel() > 1 && $parent->getId() != $object->getId()) {
$code[] = $parent->getName();
}
}
$code[] = $object->getName();
$code = implode('-', $code);
}
$object->setData($attributeName, $object->formatUrlKey($code));
return $this;
}
示例11: getCategoryUrl
/**
* Get url for category data
*
* @param Mage_Catalog_Model_Category $category
* @return string
*/
public function getCategoryUrl($category)
{
if ($category instanceof Mage_Catalog_Model_Category) {
$url = $category->getUrl();
} else {
$url = $this->_getCategoryInstance()->setData($category->getData())->getUrl();
}
return Mage::getModel('core/url')->sessionUrlVar($url);
}
示例12: _prepareDataForAllFields
/**
* Prepare array of category data to insert or update.
*
* array(
* 'field_name' => 'value'
* )
*
* @param Mage_Catalog_Model_Category $category
* @param array $replaceFields
* @return array
*/
protected function _prepareDataForAllFields($category, $replaceFields = array())
{
$table = $this->_getReadAdapter()->describeTable($this->getMainStoreTable($category->getStoreId()));
$data = array();
foreach ($table as $column => $columnData) {
if (null !== $category->getData($column)) {
if (key_exists($column, $replaceFields)) {
$value = $category->getData($replaceFields[$column]);
} else {
$value = $category->getData($column);
}
if (is_array($value)) {
$value = implode(',', $value);
}
$data[$column] = $value;
}
}
return $data;
}
示例13: getObject
public function getObject(Mage_Catalog_Model_Category $category)
{
/** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
$productCollection = $category->getProductCollection();
$category->setProductCount($productCollection->addMinimalPrice()->count());
$transport = new Varien_Object();
Mage::dispatchEvent('algolia_category_index_before', array('category' => $category, 'custom_data' => $transport));
$customData = $transport->getData();
$storeId = $category->getStoreId();
$category->getUrlInstance()->setStore($storeId);
$path = '';
foreach ($category->getPathIds() as $categoryId) {
if ($path != '') {
$path .= ' / ';
}
$path .= $this->getCategoryName($categoryId, $storeId);
}
$image_url = NULL;
try {
$image_url = $category->getImageUrl();
} catch (Exception $e) {
/* no image, no default: not fatal */
}
$data = array('objectID' => $category->getId(), 'name' => $category->getName(), 'path' => $path, 'level' => $category->getLevel(), 'url' => $category->getUrl(), '_tags' => array('category'), 'popularity' => 1, 'product_count' => $category->getProductCount());
if (!empty($image_url)) {
$data['image_url'] = $image_url;
}
foreach ($this->config->getCategoryAdditionalAttributes($storeId) as $attribute) {
$value = $category->getData($attribute['attribute']);
$attribute_ressource = $category->getResource()->getAttribute($attribute['attribute']);
if ($attribute_ressource) {
$value = $attribute_ressource->getFrontend()->getValue($category);
}
if (isset($data[$attribute['attribute']])) {
$value = $data[$attribute['attribute']];
}
if ($value) {
$data[$attribute['attribute']] = $value;
}
}
$data = array_merge($data, $customData);
foreach ($data as &$data0) {
$data0 = $this->try_cast($data0);
}
return $data;
}
示例14: getAllCategoryIdsFromCategory
/**
* @param Mage_Catalog_Model_Category $category
* @return array
*/
public function getAllCategoryIdsFromCategory(Mage_Catalog_Model_Category $category = null)
{
if (empty($category)) {
return array();
}
$_pathIds = $category->getData("path");
return explode("/", $_pathIds);
}
示例15: getCategoryUrl
/**
* Retrieve category url
*
* @param Mage_Catalog_Model_Category $category
* @return string
*/
public function getCategoryUrl($category)
{
return Mage::getModel('catalog/category')->setData($category->getData())->getCategoryUrl();
}