本文整理汇总了PHP中Mage_Catalog_Model_Category::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Category::getUrl方法的具体用法?PHP Mage_Catalog_Model_Category::getUrl怎么用?PHP Mage_Catalog_Model_Category::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Category
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Category::getUrl方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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;
}
示例3: getUrl
/**
* Override return URL fucntion to support city\zipcode oriented URLs
*
*
* @return string $url
*/
public function getUrl()
{
// Init variables
$regUrlKey = Mage::registry('bloom_nations_zipcode_info');
$primaryCity = false;
$zipcode = false;
$url = false;
if (empty($regUrlKey)) {
// Try to get current location info
if (isset($_COOKIE['bloom_nations_zipcode_info'])) {
$regUrlKey = $_COOKIE['bloom_nations_zipcode_info'];
} else {
// Retreat to basic get URL function if initialization failed
return parent::getUrl();
}
}
// Check if this is one of the Store Fronts
if ($this->getParentCategory() && $this->getParentCategory()->getId() == 20) {
$cat = $this;
if (!$this->hasData('yelp_api')) {
$cat = Mage::getModel('catalog/category')->load($this->getId());
}
if ($vendor = Mage::getModel('udropship/vendor')->load($cat->getYelpApi())) {
$city = str_replace(' ', '-', strtolower($vendor->getCity()));
$url = '/' . $city . '-' . $cat->getUrlKey() . '.html';
return $url;
}
}
// Regular Category URL
if (!empty($regUrlKey)) {
$regUrlKey = strtolower(str_replace(' ', '-', str_replace(',', '', $regUrlKey)));
// Zipcode info in the location
if (isset($_COOKIE['bloom_nations_zipcode']) && strlen($_COOKIE['bloom_nations_zipcode']) == 5) {
$zipcode = addslashes((string) $_COOKIE['bloom_nations_zipcode']);
}
if (Mage::registry('current_category')) {
$zipcode = '';
}
if (isset($_GET['zipcode'])) {
$zipcode = addslashes((string) $_GET['zipcode']);
}
// Primary city logic
if (Mage::registry('primary-city')) {
$regUrlKey = Mage::registry('primary-city') . '-ca/' . substr_replace($regUrlKey, '', -3);
} elseif (isset($_COOKIE['primary-city']) && !empty($_COOKIE['primary-city'])) {
$regUrlKey = $_COOKIE['primary-city'] . '-ca/' . substr_replace($regUrlKey, '', -3);
}
$url = '/' . $regUrlKey . '/' . $this->getUrlKey() . '-bouquets.html';
if (strlen($zipcode) == 5) {
$url .= '?zipcode=' . $zipcode;
}
return $url;
}
return parent::getUrl();
}
示例4: linktoCategoryThumbnail
/**
* linktoCategoryThumbnail
*
* wraps the category thumbnail with a link to the category
*
* @param Mage_Catalog_Model_Category $category
* @param string $linkCss # CSS classes
* @param integer|string $width # thumbnail width
* @param integer|string $height # thumbnail height
* @return string
*/
public function linktoCategoryThumbnail(Mage_Catalog_Model_Category $category, $linkCss = '', $width = 168, $height = 168)
{
$link = '';
if ($category->getIsActive()) {
$catUrl = $category->getUrl();
$catName = $this->htmlEscape($category->getName());
$catThumbnail = self::displayCategoryThumbnail($category, $width, $height);
$link = "\n <a class='{$linkCss}' href='{$catUrl}' title='{$catName}'>\n {$catThumbnail}\n <span class='category-name'>{$catName}</span>\n </a>\n ";
}
return $link;
}
示例5: testGetUrl
public function testGetUrl()
{
$this->assertStringEndsWith('catalog/category/view/', $this->_model->getUrl());
$this->_model->setUrl('test_url');
$this->assertEquals('test_url', $this->_model->getUrl());
$this->_model->setUrl(null);
$this->_model->setRequestPath('test_path');
$this->assertStringEndsWith('test_path', $this->_model->getUrl());
$this->_model->setUrl(null);
$this->_model->setRequestPath(null);
$this->_model->setId(1000);
$this->assertStringEndsWith('catalog/category/view/id/1000/', $this->_model->getUrl());
}
示例6: getCategoryUrlInStore
/**
* Get Category URL in a specific store
*
* @param Mage_Catalog_Model_Category $category
* @param Mage_Core_Model_Store $store
*
* @return string
*/
public function getCategoryUrlInStore($category, $store)
{
if (!$store instanceof Mage_Core_Model_Store) {
$store = Mage::app()->getStore($store);
}
$idPath = 'category/' . $category->getId();
foreach ($this->getStoreUrls($idPath) as $storeId => $url) {
if ($storeId == $store->getId()) {
return $url;
}
}
return $category->getUrl();
}
示例7: addCategoryToCrawlerQueue
/**
* Add URLs to the queue by category model
*
* @param Mage_Catalog_Model_Category $category
* @return int
*/
public function addCategoryToCrawlerQueue($category)
{
$catUrls = array();
$origStore = Mage::app()->getStore();
foreach (Mage::app()->getStores() as $storeId => $store) {
Mage::app()->setCurrentStore($store);
$catUrls[] = $category->getUrl();
}
Mage::app()->setCurrentStore($origStore);
return $this->addUrlsToCrawlerQueue($catUrls);
}
示例8: 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);
}
示例9: _getCategoryRequestPath
/**
* Get category request path
*
* @param Mage_Catalog_Model_Category $category
* @return string
* @deprecated since 1.13.0.2
*/
protected function _getCategoryRequestPath(Mage_Catalog_Model_Category $category)
{
/**
* Initialize request_path value
*/
$category->getUrl();
/** @var $helper Enterprise_Catalog_Helper_Data */
$helper = $this->_factory->getHelper('enterprise_catalog');
return $helper->getCategoryRequestPath($category->getRequestPath(), $category->getStoreId());
}
示例10: 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;
}
示例11: getCategoryUrl
public function getCategoryUrl(Mage_Catalog_Model_Category $category)
{
return $category->getUrl();
}
示例12: categoryToArray
/**
* Based on provided category object returns small category array with necessary data.
*
* @param Mage_Catalog_Model_Category $c
* @return array
*/
public function categoryToArray($c)
{
$category = array();
$category['url'] = $c->getUrl();
$category['name'] = Mage::helper('core')->htmlEscape($c->getName());
$category['image'] = $c->getImage();
$category['thumbnail'] = $c->getThumbnail();
$category['description'] = Mage::helper('core')->htmlEscape($c->getDescription());
$category['meta_description'] = Mage::helper('core')->htmlEscape($c->getMetaDescription());
return $category;
}
示例13: getDeepLinkUrl
/**
* @param Mage_Catalog_Model_Category $category
* @return mixed
*/
public function getDeepLinkUrl($category)
{
return $this->_getExportHelper()->parseUrl($category->getUrl());
}