Full Trust European Hosting

BLOG about Full Trust Hosting and Its Technology - Dedicated to European Windows Hosting Customer

Magento Hosting - HostForLIFE.eu :: How to Getting A Products URL on Magento?

clock April 3, 2020 08:14 by author Peter

In this post, I will show you how to get a products URL on Magento. There is 3 methods you can use, all of which are in Mage_Catalog_Model_Product. And here is the code:
public function getUrlPath($category=null)
public function getUrlInStore($params = array())
public function getProductUrl($useSid = null)

The simplest way to explain is to just show the results of many calls. Given a product whose URL key is scott-large-coffee-table-set-multicolour upon the domain of http :// created. local the results are :
$product->getUrlPath();
    'scott-large-coffee-table-set-multicolour'
$product->getUrlPath($category);
    'tables/scott-large-coffee-table-set-multicolour'
// you cannot stop this method adding ___store to the URL, even by setting _store_to_url to false
$product->getUrlInStore();
    'http://made.local/tables/scott-large-coffee-table-set-multicolour?___store=default'
// you cannot stop this method adding ___store to the URL, even by setting _store_to_url to false
// note - see the "using _ignore_category" section below for an arguable bug with using this param
$product->getUrlInStore(array('_ignore_category' => true));
    'http://made.local/scott-large-coffee-table-set-multicolour?___store=default'
$product->getProductUrl();
    'http://made.local/tables/scott-large-coffee-table-set-multicolour'
$product->getProductUrl(true);
    'http://made.local/tables/scott-large-coffee-table-set-multicolour'


To discover what some other params could be passed to getUrlInStore (), notice URL Route Parameters. Using _ignore_category. The brief version, I wouldn't use this param, and rather use Mage: getUrl ($product-getUrlPath ())

In case you first fetch a products URL that contains the category, then use a similar product instance to commit to fetch a non-category URL, you'll rather both times obtain a URL that includes the category, begin to see the below code :
$product = Mage::getModel('catalog/product');
$product->getUrlInStore();
    'http://made.local/sofas/peter-2-seater-sofa-blue?___store=default'
$product->getUrlInStore(array('_ignore_category' => true));
    'http://made.local/sofas/peter-2-seater-sofa-blue?___store=default'
$product = Mage::getModel('catalog/product');
$product->getUrlInStore(array('_ignore_category' => true));
    'http://made.local/peter-2-seater-sofa-blue?___store=default'

The problem lies using the request_path key upon the $product model, that the Mage_Catalog_Model_Product_Url : : getUrl () sets, to become a cached worth for an otherwise intensive method of resolving a URL rewrite to an item inside a category.

To solve this, unset request_path first, as beneath :
$product->unsRequestPath();
$product->getUrlInStore(array('_ignore_category' => true));
    'http://made.local/peter-2-seater-sofa-blue?___store=default'

Note which any technique outlined in the top of the card that leads to the category to be present inside the returned URL can have a similar effect of caching the category.

 



FREE Magento Spain Hosting - HostForLIFE.eu :: How to Reinstall Magento Engine without ReUploading The Files

clock March 29, 2014 19:55 by author Peter

Magento is ecommerce software that is available for free download for their website. There are three versions of Magento Hosting available and only one of them is free. The three versions are the community edition, Enterprise Edition and Magento Go.

Magento is highly versatile software and has become popular in a very short span of time. There are many ecommerce software that have been around for a long time though Magento has a great many features built in to the basic installation that attracts a lot many more people. The fact that it also provides a very simple interface helps too. In addition to that, Magento also provides the feature where you can add additional modules to the system. This is done via the extension interface. Furthermore you can make your own functionality or modules to suit the unique requirement that you may be having.

While messing around with the Magento system yourself trying to implement new feature or simply trying a new skin it often happens that Magento freezes itself due to some incompatibility. This is when it will display an error stating that you require to reinstall the Magento Engine. The end users often try to go around the admin panel and begin searching for a button that would reinstall the Magento Engine. But things are not that simple when it comes to reinstalling the Magento Engine and each situation is usually unique. You need to follow proper steps and procedures in order to do so. The Magento Engine can be reinstalled in the following manner.

1. Login to your web server via the cPanel and access the database via phpMyAdmin or a similar database administrator.

2. Drop the tables and in case you have made customizations to the tables you can simply empty the tables.

3. You can then open Magento directory in the file manager and go to the folder app/etc.

4. Here you need to delete the file by the name local.xml.

5. Now when you try to load your Magento website in the browser you will find that the installation page is disp.



About HostForLIFE

HostForLIFE is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.


Tag cloud

Sign in