Ejemplo n.º 1
0
 static function create_bundle($bundle)
 {
     $params = JComponentHelper::getParams('com_joomdle');
     $shop = $params->get('shop_integration');
     // Insert record in bundles table
     $db = JFactory::getDBO();
     $b->courses = implode(',', $bundle['courses']);
     $b->name = $bundle['name'];
     $b->description = $bundle['description'];
     $b->cost = $bundle['cost'];
     $b->currency = $bundle['currency'];
     /* Update record */
     if (array_key_exists('id', $bundle)) {
         $b->id = $bundle['id'];
         $db->updateObject('#__joomdle_bundles', $b, 'id');
     } else {
         /* Insert new record */
         $db->insertObject('#__joomdle_bundles', $b);
         $bundle['id'] = $db->insertid();
     }
     switch ($shop) {
         case 'tienda':
             JoomdleHelperShop::create_bundle_on_tienda($bundle);
             break;
         case 'virtuemart2':
             JoomdleHelperShop::create_bundle_on_vm2($bundle);
             break;
         case 'hikashop':
             JoomdleHelperShop::create_bundle_on_hikashop($bundle);
             break;
         default:
             JPluginHelper::importPlugin('joomdleshop');
             $dispatcher = JDispatcher::getInstance();
             $dispatcher->trigger('onCreateBundle', array($bundle));
             break;
     }
 }