Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

SS 2.3.3 and ecommerce 0.6 error in object.php when installing and dev/build


Reply


2 Posts   1324 Views

Avatar
Siv

Community Member, 6 Posts

17 August 2009 at 7:19pm

Hello!

We got a error message when we tried to install ecommerce 0.6 width Silverstripe version 2.3.3 in object.php, line 405. We had to comment out this lines, then it worked good. But we worrie about that commenting out this lines could cause an other error someplace in the system. The code looks like this (we commented out the last lines):

/**
    * Add an extension to a specific class.
    * As an alternative, extensions can be added to a specific class
    * directly in the {@link Object::$extensions} array.
    * See {@link SiteTree::$extensions} for examples.
    * Keep in mind that the extension will only be applied to new
    * instances, not existing ones (including all instances created through {@link singleton()}).
    *
    * @param string $class Class that should be decorated - has to be a subclass of {@link Object}
    * @param string $extension Subclass of {@link Extension} with optional parameters
    * as a string, e.g. "Versioned" or "Translatable('Param')"
    */
   public static function add_extension($class, $extension) {
      if(!preg_match('/^([^(]*)/', $extension, $matches)) {
         return false;
      }
      $extensionClass = $matches[1];
      if(!class_exists($extensionClass)) {
         user_error(sprintf('Object::add_extension() - Can\'t find extension class for "%s"', $extensionClass), E_USER_ERROR);
      }
      
      if(!is_subclass_of($extensionClass, 'Extension')) {
         user_error(sprintf('Object::add_extension() - Extension "%s" is not a subclass of Extension', $extensionClass), E_USER_ERROR);
      }
      
      // unset some caches
      self::$cached_statics[$class]['extensions'] = null;
      $subclasses = ClassInfo::subclassesFor($class);
      $subclasses[] = $class;
      if($subclasses) foreach($subclasses as $subclass) {
         unset(self::$classes_constructed[$subclass]);
      }
      
      // merge with existing static vars
      self::add_static_var($class, 'extensions', array($extension));
      
      // load statics now for DataObject classes
      //if(is_subclass_of($class, 'DataObject')) {
         //DataObjectDecorator::load_extra_statics($class, $extensionClass);
      //}
   }

Has anyone had this problem, and is it a better way to solve it? Any suggestions?

Have a nice day from Norway!

Avatar
runnerman

Community Member, 24 Posts

3 September 2009 at 9:43pm

Hi Siv,

What error did you receive? If you're able to reproduce it (or have got it saved somewhere) could you post it here?

Thanks!