Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

4.2 - Clean Urls - Complete url

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 01-20-2009, 04:23 PM
 
Oktane Design Oktane Design is offline
 

Member
  
Join Date: Apr 2008
Posts: 29
 

Default 4.2 - Clean Urls - Complete url

Hello Guys,

Is there a way in X-cart 4.2 to keeps the complete url with the clean url option?

If i go trough the categories it only shows the first level category.

I would like to have something like this ;

http://www.domain.com/category1/category2/product-name.html

instead of

http://www.domain.com/product-name.html

Thanks a lot
__________________
X-Cart version 4.2
Reply With Quote
  #2  
Old 02-12-2009, 12:10 PM
  toolauthority's Avatar 
toolauthority toolauthority is offline
 

Advanced Member
  
Join Date: Jan 2009
Location: Grand Rapids, MI
Posts: 92
 

Default Re: 4.2 - Clean Urls - Complete url

Find this part of the code in the "skin1\admin\main\category_modify.tpl" file. I add or changed the lines that are bolded.


<tr>
<td height="10" class="FormButton" nowrap="nowrap">{$lng.lbl_category}:</td>
<td width="10" height="10"><font class="Star">*</font></td>
<td height="10">
{capture name=the_cats}
{assign var="the_cat" value=""}
{assign var="the_count" value=0}
{section name=position loop=$category_location}
{strip}
{if $the_count == 1}
{assign var="cat" value=$category_location[position].0}
{$the_cat|cat:$cat}
{else}
{assign var='the_count' value=1}
{/if}
{/strip}
{/section}
{/capture}
{assign var="the_cats" value=$smarty.capture.the_cats|substr:1}

<input type="text" name="category_name" id="category_name" maxlength="255" size="65" value="{if $category_error ne ""}{$smarty.post.category_name|escape:"html"}{else if $mode ne "add"}{$current_category.category|escape:"html "}{/if}" {if $config.SEO.clean_urls_enabled eq "Y"} onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url,'{$smarty.capture.the_cats|strip:"/"|substr:1}'+this.value)"{/if}/>
{if $category_error ne ""}
{if $category_error eq "2"}
<font color="red">&lt;&lt; {$lng.lbl_category_already_exists}</font>
{else}
<font color="red">&lt;&lt; {$lng.lbl_category_wrong_value}</font>
{/if}
{/if}
</td>
</tr>




also in the file "skin1\check_clean_url.js" i changed the commented line to the other line.

//to_field.value = from_field.value.replace(/[\&]/g, '-and-').replace(/[^a-zA-Z0-9._-]/g, '-').replace(/[-]+/g, '-').replace(/-$/, '');

to_field.value = from_value.replace(/[\&]/g, '-and-').replace(/[^a-zA-Z0-9._/-]/g, '-').replace(/[-]+/g, '-').replace(/-$/, '');
__________________
x-cart 4.2.0 | centos 5.2 | php 5.2.6 | mysqld 5.0.45-log
Reply With Quote
  #3  
Old 01-14-2010, 06:15 PM
 
manishp manishp is offline
 

Advanced Member
  
Join Date: Jul 2009
Posts: 41
 

Default Re: 4.2 - Clean Urls - Complete url

Quote:
Originally Posted by toolauthority
Find this part of the code in the "skin1\admin\main\category_modify.tpl" file. I add or changed the lines that are bolded.


<tr>
<td height="10" class="FormButton" nowrap="nowrap">{$lng.lbl_category}:</td>
<td width="10" height="10"><font class="Star">*</font></td>
<td height="10">
{capture name=the_cats}
{assign var="the_cat" value=""}
{assign var="the_count" value=0}
{section name=position loop=$category_location}
{strip}
{if $the_count == 1}
{assign var="cat" value=$category_location[position].0}
{$the_cat|cat:$cat}
{else}
{assign var='the_count' value=1}
{/if}
{/strip}
{/section}
{/capture}
{assign var="the_cats" value=$smarty.capture.the_cats|substr:1}

<input type="text" name="category_name" id="category_name" maxlength="255" size="65" value="{if $category_error ne ""}{$smarty.post.category_name|escape:"html"}{else if $mode ne "add"}{$current_category.category|escape:"html "}{/if}" {if $config.SEO.clean_urls_enabled eq "Y"} onchange="javascript: if (this.form.clean_url.value == '') copy_clean_url(this, this.form.clean_url,'{$smarty.capture.the_cats|strip:"/"|substr:1}'+this.value)"{/if}/>
{if $category_error ne ""}
{if $category_error eq "2"}
<font color="red">&lt;&lt; {$lng.lbl_category_already_exists}</font>
{else}
<font color="red">&lt;&lt; {$lng.lbl_category_wrong_value}</font>
{/if}
{/if}
</td>
</tr>




also in the file "skin1\check_clean_url.js" i changed the commented line to the other line.

//to_field.value = from_field.value.replace(/[\&]/g, '-and-').replace(/[^a-zA-Z0-9._-]/g, '-').replace(/[-]+/g, '-').replace(/-$/, '');

to_field.value = from_value.replace(/[\&]/g, '-and-').replace(/[^a-zA-Z0-9._/-]/g, '-').replace(/[-]+/g, '-').replace(/-$/, '');

I followed the exact steps mentioned above, but couldn't see the category embedded in the clean URL. anything I can be missing?
__________________
X-Cart: 4.2.1
Reply With Quote
  #4  
Old 03-06-2010, 12:55 PM
 
manishp manishp is offline
 

Advanced Member
  
Join Date: Jul 2009
Posts: 41
 

Default Re: 4.2 - Clean Urls - Complete url

Has anyone been able to do this without a 3rd part tool?

I have followed everything listed in this post, but still doesn't work.

Any help will be greatly appreciated.

Thanks so much!!
__________________
X-Cart: 4.2.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:49 AM.

   

 
X-Cart forums © 2001-2020