News:

Looking for documentation? Take a look on our wiki

Main Menu

Revision 4902 slug problem

Started by Stephen Roberts, December 02, 2011, 00:30:59 AM

Previous topic - Next topic

Stephen Roberts

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

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):

$q = 'SELECT `'.$slugName.'` FROM `'.$this->_tbl.'` WHERE `'.$slugName.'` =  "'.$this->$slugName.'" ';

to

$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

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stephen Roberts

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

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

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/