News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Core hacks that should not be needed...

Started by Genius WebDesign, August 02, 2014, 18:35:43 PM

Previous topic - Next topic

Genius WebDesign

Hello,

As a developer I am very frustrated when I need to make core hacks, especially when I´m setting up a webshop.
The main problem is of course that component updates becomes a tedious extra work load when I have to go through core files and implement previous corrections..

Here are a couple of core hacks that are pretty much necessary for any shop to work using Virtuemart.

Virtuemart version 2.6.6

#Hack 1
- problem: Whenever a customer goes to cart page this system message is displayed "COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS".
This message only needs to be shown in case the "terms od use" is not checked before cart form is submitted.
So we need to change the cart helper file to only show this message if the cart form is submitted.
- solution: Modify this file
/components/com_virtuemart/helpers/cart.php

line 935 - 940
if(empty($this->tosAccepted) and !empty($agreed->required) and $validUserDataBT!==-1){
$redirectMsg = null;// JText::_('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
$this->tosAccepted = false;
vmInfo('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS','COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
return $this->redirecter('index.php?option=com_virtuemart&view=cart' , $redirectMsg);
}

change to
if(empty($this->tosAccepted) and !empty($agreed->required) and $validUserDataBT!==-1 and $_SERVER['REQUEST_METHOD'] == 'POST'){
$redirectMsg = null;// JText::_('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
$this->tosAccepted = false;
vmInfo('COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS','COM_VIRTUEMART_CART_PLEASE_ACCEPT_TOS');
return $this->redirecter('index.php?option=com_virtuemart&view=cart' , $redirectMsg);
}



#Hack 2
- problem: Breadcrumbs show incorrect link-tree on product page when product belongs to more than one category.
- solution: Modify this file
/components/com_virtuemart/views/productdetails/view.html.php
line 165 - 173
Comment out / remove this code
if ($category->parents) {
foreach ($category->parents as $c) {
if(is_object($c) and isset($c->category_name)){
$pathway->addItem(strip_tags($c->category_name), JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $c->virtuemart_category_id, FALSE));
} else {
vmdebug('Error, parent category has no name, breadcrumb maybe broken, category',$c);
}
}
}



AH

Have you also noticed that when a product belongs to more than one category

View a category with the product
Then immediately select another category to which the product belongs

The category id/sef id will be the previous category not the current one.

Refresh the page and all is well.

Not worked out why yet
Regards
A

Joomla 3.10.11
php 8.0

Milbo

Since Hack #1 is not necessary, cause it is already that way, i did not read the second. It was sometimes that way, but as far as I know only for testversions, cause else we call it a bug.

Very typical for VM users noticed that already yesterday.

Your expectation of VM is too low and is ashaming me. Maybe one version had this bug, one user writes a hack, the problem is solved in the core, years later the "pro" still uses the hack.

Yesterday someone told me that people ask for the old vm1 checkokut. I really wonder that no one noticed that it take less then 10 minutes to create that. :-(
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

AH

#3
Milbo

Thought you were on holiday!

The subject name was not very well considered by the poster.

2.6.7 appears to have the product in multiple category bug that I have reported in my post

(and the breadcrumb error exists)

Product exists in multiple categories:-
To see the bug:-
Quote
View a category with the product
Then immediately select another category to which the product belongs

The category id/sef id will be the previous category not the current one.

Refresh the page and all is well.


I never keep my hacks in when the core code caters for them - kdiff3 should be on everyones code compare list
Regards
A

Joomla 3.10.11
php 8.0