[SOLVED] Bug: Back to category button NOT working, wrong category ID

Started by tzic, April 08, 2014, 16:20:26 PM

Previous topic - Next topic

tzic

Hello,

I am experiencing a very strange bug. Since latest update the "Back to category" button was not working. So at the overrides folder I changed the code to


<div class="back-to-category"> <?php echo $this->product->virtuemart_category_id ?>
    <a href="<?php echo ('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$this->product->virtuemart_category_id?>" class="product-details" title="<?php echo $categoryName ?>"><?php echo JText::sprintf('COM_VIRTUEMART_CATEGORY_BACK_TO',$categoryName)?> <? echo $this->product->category_name?></a>
</div>


the first echo is for debugging purposes, it just shows the category id before the "back to category" button. The strange - magic thing starts here. For some products eg:

- http://www.ahealthcare.gr/%CF%80%CE%AC%CE%BD%CE%B5%CF%82-hartmann/%CF%80%CE%B1%CE%BD%CE%B1-%CE%B1%CF%85%CF%84%CE%BF%CE%BA%CF%8C%CE%BB%CE%BB%CE%B7%CF%84%CE%B7-%CF%80%CE%AC%CE%BD%CE%B1-%CE%B7%CE%BC%CE%AD%CF%81%CE%B1%CF%82/molicare-%CE%B1%CF%85%CF%84%CE%BF%CE%BA%CF%8C%CE%BB%CE%BB%CE%B7%CF%84%CE%B7-%CF%80%CE%AC%CE%BD%CE%B1-%CE%B7%CE%BC%CE%AD%CF%81%CE%B1%CF%82-extra-large-%CF%84%CE%B7%CF%82-hartmann-detail 
- http://www.ahealthcare.gr/%CF%85%CF%80%CE%BF%CF%83%CE%AD%CE%BD%CF%84%CE%BF%CE%BD%CE%B1/%CF%85%CF%80%CE%BF%CF%83%CE%AD%CE%BD%CF%84%CE%BF%CE%BD%CE%B1-60%CF%8790-%CE%B1%CF%80%CE%BF%CF%81%CF%81%CE%BF%CF%86%CE%B7%CF%84%CE%B9%CE%BA%CE%B1
- http://www.ahealthcare.gr/%CE%BD%CE%BF%CF%83%CE%BF%CE%BA%CE%BF%CE%BC%CE%B5%CE%B9%CE%B1%CE%BA%CE%AD%CF%82-%CE%BA%CE%BB%CE%AF%CE%BD%CE%B5%CF%82/%CE%BA%CF%81%CE%B5%CE%B2%CE%AC%CF%84%CE%B9%CE%B1-%CE%BD%CE%BF%CF%83%CE%BF%CE%BA%CE%BF%CE%BC%CE%B5%CE%B9%CE%B1%CE%BA%CE%B5%CF%82-%CE%BA%CE%BB%CE%B9%CE%BD%CE%B5%CF%82/%CE%BD%CE%BF%CF%83%CE%BF%CE%BA%CE%BF%CE%BC%CE%B5%CE%B9%CE%B1%CE%BA%CE%B7-%CE%BA%CE%BB%CE%B9%CE%BD%CE%B7-%CF%87%CE%B5%CE%B9%CF%81%CE%BF%CE%BA%CE%B9%CE%BD%CE%B7%CF%84%CE%B7-%CF%80%CE%BF%CE%BB%CF%8D%CF%83%CF%80%CE%B1%CF%83%CF%84%CE%B7-detail
- http://www.ahealthcare.gr/eshop/%CF%80%CF%81%CE%BF%CE%B9%CE%BF%CE%BD%CF%84%CE%B1/%CE%BF%CF%85%CF%81%CE%BF%CF%83%CF%85%CE%BB%CE%BB%CE%AD%CE%BA%CF%84%CE%B5%CF%82/%CE%BF%CF%85%CF%81%CE%BF%CF%83%CF%85%CE%BB%CE%BB%CE%AD%CE%BA%CF%84%CE%B5%CF%82-detail

the button works perfectly as it should. Category ID number displays correctly before the button and the link gets you to the correct category. But for some other products it does not work! Instead of Category ID number I get a url and the button takes me to all products. Look here:

- http://www.ahealthcare.gr/eshop/%CF%80%CF%81%CE%BF%CE%B9%CE%BF%CE%BD%CF%84%CE%B1/%CE%BF%CE%BB%CE%B1-%CF%84%CE%B1-%CF%80%CF%81%CE%BF%CE%B9%CF%8C%CE%BD%CF%84%CE%B1/%CE%B5%CF%80%CE%AF%CE%B8%CE%B5%CE%BC%CE%B1-duoderm-15x15-detail
- http://www.ahealthcare.gr/%CE%BA%CE%B1%CF%84%CE%B1%CE%BA%CE%BB%CE%B9%CF%83%CE%B5%CE%B9%CF%82/%CE%B1%CE%B5%CF%81%CF%8C%CF%83%CF%84%CF%81%CF%89%CE%BC%CE%B1-%CE%BA%CE%B1%CF%84%CE%B1%CE%BA%CE%BB%CE%AF%CF%83%CE%B5%CF%89%CE%BD

I cannot find a pattern between working or not working categories / products in order to fix this. The only thing that I have noticed is that, at the products that are problematic at the end of productdetails page "all product categories" are attached (take a look at the last 2 urls above). I could not find anything else. It is obvious that in these products the script

<?php echo $this->product->virtuemart_category_id ?>

does not work or it gives wrong results (an url instead of category number) If I could fix that, the back to category button would work correctly.

Any help with that would greatly appreciated...

PS I removed the override default.php httpdocs/templates/ja_purity_ii/html/com_virtuemart/productdetails/default.php to use the original file but still no luck

Milbo

Hmmm, maybe disable the unicode sef? I think it has something todo with your SEF.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

tzic

Quote from: Milbo on April 08, 2014, 20:09:32 PM
Hmmm, maybe disable the unicode sef? I think it has something todo with your SEF.

Thank you for the reply, it was not that

I found it... take a look at the attachment. All the products that have the URL field completed in "product information" tab show that behaviour. It seems like the URL input override the category id? Anyway if I delete the URL field, category id returns ok and back to category button works as it should. If this does not happen only to me, take it into consideration for the next update

[attachment cleanup by admin]

Milbo

ahhh

this URL is to point to the URL of your distributor or manufacturer of the product, or something like this. It should not interfere, strange.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/