Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

Virtuemart user_classes and cahe problem
(1 viewing) (1) Guest
Support forum for customers who have purchased paid JoomSEF extension. Archive only, no new post can be added.

NOTE: This category has been locked. If you have purchased paid version, please, use our Support Ticket system instead. If you are using free edition, please see the Community Support section.
  • Page:
  • 1

TOPIC: Virtuemart user_classes and cahe problem

Virtuemart user_classes and cahe problem 13 years, 6 months ago #22181

  • gruz
Hi.

Joomla 1.5.23
VirtueMart 1.1.8

I have a user_class in my VM theme. Some info on user classes

When JoomSEF cache is on, I get an error from time to time at different pages:

Fatal error: Cannot redeclare class ps_product_category in ....../components/com_virtuemart/themes/ja_larix/user_class/ps_product_category.php on line 0

If JoomSEF cahce is off it works as expected - uses my user_class.

I tried to wrap my user class into additional if-class_exists statement, but this didn't help as I wanted. Instead of the error it gave me a page hadled by core VM function, not mine.

It seems the JoomSEF cache doesn't handle this VM feature correctly.

Can this be solved? Thanks.

P.S. I was googling and searchin at the forum and didn't find any close to my rtopic.
Last Edit: 13 years, 6 months ago by .
The topic has been locked.

Re: Virtuemart user_classes and cahe problem 13 years, 5 months ago #22633

  • jaku
Hello,
the VirtueMart code is a reall mess, so there may be many possible sources of this problem.

Anyway, I do not know why this should be connected with JoomSEF cache at all. It is quite strange. I am afraid the only way to discover reasons would be making some debuggin directly at the site where the problem occurs.

For sure it can be solved - almost every problem can - but the question is how much time it will take.
The topic has been locked.

Re: Virtuemart user_classes and cahe problem 13 years, 5 months ago #22657

  • gruz
Thanks for answer.

After disaling JoomSEF cache the problem didn't disappeared, as I thought before, but became more seldom. So it's not a JoomSEF problem, but a Joomla caching mechanism problem.
I had to gave up using virtuemart user classes and to alter core virtuemart files to avoid the problem at all.So my problem is not solved as I wanted, but it works.

But for understanding the roots of the problem. In each class file, i.e.
administrator/components/com_virtuemart/classes/ps_product_category.php the structure is like this, which either includes my VM template user class, which defines class ( class ps_product_category extends vm_ps_product_category { /* my methods*/ } ), or defines an empty class which extends the base one:

class vm_ps_product_category extends vmAbstractObject {
//....here goes the class methods
}
if (!defined('VM_ALLOW_EXTENDED_CLASSES') && file_exists(dirname(__FILE__).'/../virtuemart.cfg.php')) {
include_once(dirname(__FILE__).'/../virtuemart.cfg.php');
}
// If settings are loaded, extended Classes are allowed and the class exisits...
if (defined('VM_ALLOW_EXTENDED_CLASSES') && defined('VM_THEMEPATH') && VM_ALLOW_EXTENDED_CLASSES && file_exists(VM_THEMEPATH.'user_class/'.basename(__FILE__))) {
// Load the theme-user_class as extended
include_once(VM_THEMEPATH.'user_class/'.basename(__FILE__));
} else {
// Otherwise we have to use the original classname to extend the core-class
class ps_product_category extends vm_ps_product_category {}
}


And this if-include-and-define-else-define works wrong when caching.

Maybe if you read this and understand the problem from the first reading, you have a suggestion.

The web-site is lux4man.ru.
The topic has been locked.

Re: Virtuemart user_classes and cahe problem 13 years, 5 months ago #22708

  • jaku
Well,
there should be for sure added a test, that the class has not be declared yet, something like:
if (!class_exists('ps_product_category')) {
if (defined('VM_ALLOW_EXTENDED_CLASSES') && defined('VM_THEMEPATH') && VM_ALLOW_EXTENDED_CLASSES && file_exists(VM_THEMEPATH.'user_class/'.basename(__FILE__))) {
// Load the theme-user_class as extended
include_once(VM_THEMEPATH.'user_class/'.basename(__FILE__));
} else {
// Otherwise we have to use the original classname to extend the core-class
class ps_product_category extends vm_ps_product_category {}
}
}
 
Last Edit: 13 years, 5 months ago by .
The topic has been locked.

Re: Virtuemart user_classes and cahe problem 13 years, 5 months ago #22711

  • gruz
Thanks, I'll experiment. But the problem appears from time to time and it's hard to catch the moment.

Thanks once more.
The topic has been locked.
  • Page:
  • 1
User Login Empty