Author Topic: Revision 4902 slug problem  (Read 2046 times)

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Revision 4902 slug problem
« on: December 02, 2011, 00:30:59 am »
If you haven't caught this yet, there is a problem with slugs (at least on the categories). It appears that the date is being tacked onto the slug on every store to database. Example:

1. Edit category "Music" with current slug "music"
2. Hit apply. Slug is now "music2011-12-01-23-29-553"
3. Hit apply again. Slug is now "music2011-12-01-23-29-5532011-12-01-23-30-306"
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Revision 4902 slug problem
« Reply #1 on: December 02, 2011, 02:09:35 am »
FYI, I'm using Joomla! 1.5 for this.

It appears the problem is that it's not checking whether this is a new category or an existing category. Here's how I fixed it:

Change (line 434 in vmtable.php):

Code: [Select]
$q = 'SELECT `'.$slugName.'` FROM `'.$this->_tbl.'` WHERE `'.$slugName.'` =  "'.$this->$slugName.'" ';
to

Code: [Select]
$q = 'SELECT `'.$slugName.'` FROM `'.$this->_tbl.'` WHERE `'.$slugName.'` =  "'.$this->$slugName.'" AND `virtuemart_category_id`!='.$this->virtuemart_category_id;
You guys might have a better way though.
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9828
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Revision 4902 slug problem
« Reply #2 on: December 02, 2011, 09:45:01 am »
A thanks. I think people wonder how that happened.

Due the multilanguage the slug is most time in the lang table now, I added a check, should work now.

The idea of stephenroberts does not work, because the query would return nothing, when the slug is used elsewhere.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Revision 4902 slug problem
« Reply #3 on: December 02, 2011, 16:52:31 pm »
Hmm, it seemed to work to me in both the case where you add a new category or edit an existing category. I'm interested to see how you decided to solve the problem. Thanks!
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Stephen Roberts

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 142
    • SundaySchool.com
Re: Revision 4902 slug problem
« Reply #4 on: December 02, 2011, 17:39:46 pm »
I see what you're talking about now. If you're editing a category and try to name it the same as an existing category then no, it won't add a suffix to the slug the way I did it. I'll try to think through all cases next time instead of the first thing that works for me.  ;)
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9828
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Revision 4902 slug problem
« Reply #5 on: December 02, 2011, 18:49:40 pm »
oh stephenroberts, you did a good job. Finally after some months I got the real problem we had all time with it. So dont excuse yourself for doing the right thing.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/