Forum Moderators: coopster
Shop.com/buy-product-name.html
What i want to do is add category name before product-url so that URL become like....
Shop.com/category-name/buy-product-name.html
Since my support has expired i decided to do it with my self. After racking brain for an hour with nested files (one file includes another and so on) i found out the file that forms URL but stuck while making changes in PHP code. To give you detail idea I have....
Pasted code of entire file that forms URL.
also pasted htaccess rewrite rule.
Htaccess
RewriteRule ^/?buy-(.+)-low.html$ index.php?product=$1&lang=us [L,QSA]
RewriteRule ^/?(.+)-jeans-low.html$ index.php?category=$1&lang=us [L,QSA]
URL creation
<?
class BaseProduct {var $_name, $_product, $_product_pool, $_category_pool, $_prices_source, $_lang, $_cart, $_category, $_subtitle, $_category_url, $_lowest_id, $_is_combined, $_variants, $_ids;
function category($id=null)
{
if (!$this->_category ¦¦ $id)
{
if (!$id)
list($id) = array_keys($this->_product['category_id']);
$this->_category = ucwords($this->_cart->category_by_id($id));
}
return $this->_category;
}
function category_url($id=null)
{
if (!$this->_category_url)
$this->_category_url = $this->_cart->_config['is_htm']
? $this->rel($this->fname(false, $id).'.htm')
: $this->rel('?category='.urlencode(strtolower($this->category($id))));
return $this->_category_url;
}
function url($prefix='', $suffix='')
{
return $this->_cart->rel(($this->_cart->_config['is_htm'])
? $this->fname().'.htm'.($suffix ? '?'.$suffix : '')
: "?{$prefix}product=".urlencode(strtolower($this->_name)).($suffix ?'&'.$suffix :''));
}
Can you suggest changes to make URLs?
Thank you for your time to Look into.