Exemple #1
0
 public static function apply($type, &$total)
 {
     $user = JCck::getUser();
     $my_groups = $user->getAuthorisedGroups();
     $my_zones = JCckEcommerce::getUserZones();
     $currency = JCckEcommerce::getCurrency();
     $tax = '';
     $taxes = JCckEcommerce::getTaxes($type, $my_zones);
     if (count($taxes)) {
         foreach ($taxes as $p) {
             $groups = explode(',', $p->groups);
             if (count(array_intersect($my_groups, $groups)) > 0) {
                 switch ($p->tax) {
                     case 'plus':
                         $tax = $p->tax_amount;
                         $total += $tax;
                         break;
                     case 'percentage':
                         $tax = $total * $p->tax_amount / 100;
                         $total += $tax;
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     return $tax;
 }
Exemple #2
0
 public static function format($amount, $format = true)
 {
     if ($format) {
         $amount = number_format($amount, 2, JText::_('DECIMALS_SEPARATOR'), JText::_('THOUSANDS_SEPARATOR'));
     }
     $currency = JCckEcommerce::getCurrency();
     return $currency->lft . $amount . $currency->rgt;
 }
Exemple #3
0
 public static function apply($type, &$total, $params = array())
 {
     $user = JCck::getUser();
     $my_groups = $user->groups;
     /* $user->getAuthorisedGroups(); */
     $my_zones = JCckEcommerce::getUserZones();
     $currency = JCckEcommerce::getCurrency();
     $res = 0;
     $results = array('items' => array());
     $tax = '';
     $taxes = JCckEcommerce::getTaxes($type, $my_zones);
     if (count($taxes)) {
         foreach ($taxes as $p) {
             if (isset($params['target']) && $params['target']) {
                 if ($params['target'] == 'order' && $p->target == 0) {
                     // OK
                 } elseif ($params['target'] == 'product' && $p->target == 1) {
                     // OK
                 } else {
                     continue;
                 }
             }
             $groups = explode(',', $p->groups);
             if (count(array_intersect($my_groups, $groups)) > 0) {
                 switch ($p->tax) {
                     case 'plus':
                         $tax = $p->tax_amount;
                         $res += $tax;
                         $total += $tax;
                         $results['items'][$p->id] = array('type' => $p->type, 'tax' => $p->tax, 'tax_amount' => (string) $tax, 'title' => $p->title);
                         break;
                     case 'percentage':
                         $tax = $total * $p->tax_amount / 100;
                         $res += $tax;
                         $total += $tax;
                         $results['items'][$p->id] = array('type' => $p->type, 'tax' => $p->tax, 'tax_amount' => (string) $tax, 'title' => $p->title);
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     if ($res) {
         $results['total'] = (double) $res;
         return (object) $results;
     }
     return null;
 }
Exemple #4
0
 public static function buildMenu($mode, $menutitle, $moduleid, $com, $more = array())
 {
     $app = JFactory::getApplication();
     $empty = false;
     $label = $menutitle;
     $menu = new JAdminCSSCCKMenu();
     $uix = JCck::getUIX();
     if ($mode == 1 || $mode == 2) {
         if ($uix == 'compact') {
             $menu->addChild(new JCCKMenuNode($label, 'index.php?option=com_cck'), true);
             if ($mode == 2 && JFactory::getUser()->authorise('core.manage', 'com_cck')) {
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_FORM_MANAGER'), 'index.php?option=com_cck&view=types', 'class:type-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=types&task=type.add', 'class:newarticle'));
                 }
                 $menu->getParent();
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_APP_FOLDER_MANAGER'), 'index.php?option=com_cck&view=folders', 'class:folder-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=folders&task=folder.add', 'class:newarticle'));
                 }
                 $menu->getParent();
             }
         } else {
             $menu->addChild(new JCCKMenuNode($label, 'index.php?option=com_cck'), true);
             if ($mode == 2 && JFactory::getUser()->authorise('core.manage', 'com_cck')) {
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_CONTENT_TYPE_MANAGER'), 'index.php?option=com_cck&view=types', 'class:type-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=types&task=type.add', 'class:newarticle'));
                 }
                 $menu->getParent();
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_FIELD_MANAGER'), 'index.php?option=com_cck&view=fields', 'class:field-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=fields&task=field.add', 'class:newarticle'));
                 }
                 $menu->getParent();
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_SEARCH_TYPE_MANAGER'), 'index.php?option=com_cck&view=searchs', 'class:search-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=searchs&task=search.add', 'class:newarticle'));
                 }
                 $menu->getParent();
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_TEMPLATE_MANAGER'), 'index.php?option=com_cck&view=templates', 'class:template-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=templates&task=template.add', 'class:newarticle'));
                 }
                 $menu->getParent();
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_APP_FOLDER_MANAGER'), 'index.php?option=com_cck&view=folders', 'class:folder-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=folders&task=folder.add', 'class:newarticle'));
                 }
                 $menu->getParent();
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_SITE_MANAGER'), 'index.php?option=com_cck&view=sites', 'class:site-manager'), true);
                 if ($more['new'] == 1) {
                     $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_NEW'), 'index.php?option=com_cck&view=folders&task=site.add', 'class:newarticle'));
                 }
                 $menu->getParent();
             }
         }
         $menu->addSeparator();
         $menu->addChild(new JCCKMenuNode('SEBLOD.com', 'http://www.seblod.com/', 'class:cck', false, '_blank'), true);
         $menu->addChild(new JCCKMenuNode('Community', 'http://www.seblod.com/community', 'class:cck', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Blog', 'http://www.seblod.com/community/blog', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Events', 'http://www.seblod.com/community/events', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Forums', 'http://www.seblod.com/community/forums', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Showcase', 'http://www.seblod.com/community/showcase', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Social Hub', 'http://www.seblod.com/community/social-hub', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Testimonials', 'http://www.seblod.com/community/testimonials', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Users', 'http://www.seblod.com/community/users', '', false, '_blank'));
         $menu->addSeparator();
         $menu->addChild(new JCCKMenuNode('Products', 'http://www.seblod.com/products', 'class:cck', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Editor\'s Picks', 'http://www.seblod.com/products/editors-picks', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- New', 'http://www.seblod.com/products/new', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Popular', 'http://www.seblod.com/products/popular', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Top', 'http://www.seblod.com/products/top', '', false, '_blank'));
         $menu->addSeparator();
         $menu->addChild(new JCCKMenuNode('Resources', 'http://www.seblod.com/resources', 'class:cck', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Books', 'http://www.seblod.com/resources/books', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Manuals', 'http://www.seblod.com/resources/manuals', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Marketing', 'http://www.seblod.com/resources/marketing', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Tracker', 'http://www.seblod.com/resources/tracker', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Tutorials', 'http://www.seblod.com/resources/tutorials', '', false, '_blank'));
         $menu->addChild(new JCCKMenuNode('- Videos', 'http://www.seblod.com/resources/videos', '', false, '_blank'));
         $menu->addSeparator();
         $menu->getParent();
     } elseif ($mode == 3) {
         $uix_ecommerce = JCckEcommerce::getUIX();
         $product_manager = JComponentHelper::getParams('com_cck_ecommerce')->get('product_manager_link');
         $menu->addChild(new JCCKMenuNode($label, 'index.php?option=com_cck_ecommerce'), true);
         $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_CART_MANAGER'), 'index.php?option=com_cck_ecommerce&view=carts', 'class:cart-manager'), true);
         $menu->getParent();
         if ($uix_ecommerce == 'full') {
             $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_ORDER_MANAGER'), 'index.php?option=com_cck_ecommerce&view=orders', 'class:order-manager'), true);
             $menu->getParent();
             if ($more['ecommerce']) {
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_PAYMENT_MANAGER'), 'index.php?option=com_cck_ecommerce&view=payments', 'class:payment-manager'), true);
                 $menu->getParent();
             }
             if ($product_manager) {
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_PRODUCT_MANAGER'), $product_manager, 'class:product-manager'), true);
                 $menu->getParent();
             }
             if ($more['ecommerce']) {
                 $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_SHIPPING_MANAGER'), 'index.php?option=com_cck_ecommerce&view=shippings', 'class:shipping-manager'), true);
                 $menu->getParent();
             }
             $menu->addChild(new JCCKMenuNode(JText::_('MOD_CCK_MENU_STORE_MANAGER'), 'index.php?option=com_cck_ecommerce&view=stores', 'class:store-manager'), true);
             $menu->getParent();
         }
     } elseif ($mode == 4) {
         $items = JCckDatabase::loadObjectList('SELECT title as text, name as value, id FROM #__cck_core_types' . ' WHERE published = 1 AND location != "none" AND location != "site" AND storage_location != "none" ORDER BY text');
         $menu->addChild(new JCCKMenuNode($label), true);
         if (count($items)) {
             $link = 'index.php?option=com_cck&view=form&type=';
             $user = JFactory::getUser();
             foreach ($items as $item) {
                 if ($user->authorise('core.create', 'com_cck.form.' . $item->id)) {
                     $text = strlen($item->text) > 30 ? substr($item->text, 0, 30) . '..' : $item->text;
                     $menu->addChild(new JCCKMenuNode(JText::_($text), $link . $item->value, 'newarticle'));
                 }
             }
         }
     } elseif ($mode == 5) {
         $user = JFactory::getUser();
         $groups = implode(',', $user->getAuthorisedViewLevels());
         $items = JCckDatabase::loadObjectList('SELECT title as text, name as value, id FROM #__cck_core_searchs' . ' WHERE published = 1 AND location !="none" AND location != "site" AND access IN (' . $groups . ') ORDER BY text');
         $menu->addChild(new JCCKMenuNode($label), true);
         if (count($items)) {
             $link = 'index.php?option=com_cck&view=list&search=';
             $user = JFactory::getUser();
             foreach ($items as $item) {
                 $text = strlen($item->text) > 30 ? substr($item->text, 0, 30) . '..' : $item->text;
                 $menu->addChild(new JCCKMenuNode(JText::_($text), $link . $item->value, 'component'));
             }
         }
     } elseif ($mode == 6) {
         $addons = JCckDatabase::loadObjectList('SELECT a.element, b.title FROM #__extensions AS a' . ' LEFT JOIN #__menu AS b on b.component_id = a.extension_id' . ' WHERE a.type = "component" AND a.element LIKE "com_cck\\_%" ORDER BY title');
         $menu->addChild(new JCCKMenuNode($label), true);
         if (count($addons)) {
             foreach ($addons as $addon) {
                 $menu->addChild(new JCCKMenuNode($addon->title, 'index.php?option=' . $addon->element, 'component'));
             }
         }
     } else {
         $empty = true;
         if (strpos($label, 'icon-16-') !== false) {
             $class = str_replace('icon-16-', '', $label) . '||root-icon-position';
             $label = ' ';
         } else {
             $class = '';
         }
         $menu->addChild(new JCCKMenuNode($label, '#', $class), true);
     }
     if (count($com)) {
         if (!$empty) {
             $menu->addSeparator();
         }
         foreach ($com as $key => $item) {
             $link = null;
             $link = explode('||', $item);
             if (strpos($key, 'free') === false) {
                 $link[1] = $link[1];
                 $link[2] = $link[2] ? $link[2] : 'component';
             } else {
                 $link[2] = $link[2] ? str_replace(array('icon-16-', '.png'), '', $link[2]) : 'component';
             }
             $menu->addChild(new JCCKMenuNode(JText::_($link[0]), $link[1], $link[2]));
         }
     }
     $menu->getParent();
     // TK added menutitle to menuname
     $menu->renderMenu('cck_menu_jseblod' . $moduleid, '');
 }
Exemple #5
0
 public static function format($amount)
 {
     $currency = JCckEcommerce::getCurrency();
     return $currency->lft . $amount . $currency->rgt;
 }
Exemple #6
0
 public static function getTaxes($type = '', $zones = array())
 {
     if (!self::$taxes) {
         self::$taxes = self::_setTaxes($zones);
     }
     if ($type) {
         return isset(self::$taxes[$type]) ? self::$taxes[$type] : array();
     } else {
         $taxes = array();
         if (count(self::$taxes)) {
             foreach (self::$taxes as $k => $p) {
                 foreach ($p as $v) {
                     $taxes[] = $v;
                 }
             }
         }
         return $taxes;
     }
 }
    $menu->addChild(new JMenuNode('Popular', 'http://www.seblod.com/products/popular', '', false, '_blank'));
    $menu->addChild(new JMenuNode('Top', 'http://www.seblod.com/products/top', '', false, '_blank'));
    $menu->addChild(new JMenuNode('VIP', 'http://www.seblod.com/products/vip', '', false, '_blank'));
    $menu->getParent();
    $menu->addChild(new JMenuNode('- ' . JText::_('MOD_CCK_MENU_SEBLOD_COM_RESOURCES'), 'http://www.seblod.com/resources', 'cck', false, '_blank'), true);
    $menu->addChild(new JMenuNode('FAQs', 'http://www.seblod.com/resources/faq', '', false, '_blank'));
    $menu->addChild(new JMenuNode('Manuals', 'http://www.seblod.com/resources/manuals', '', false, '_blank'));
    $menu->addChild(new JMenuNode('Marketing', 'http://www.seblod.com/resources/marketing', '', false, '_blank'));
    $menu->addChild(new JMenuNode('Tracker', 'http://www.seblod.com/resources/tracker', '', false, '_blank'));
    $menu->addChild(new JMenuNode('Tutorials', 'http://www.seblod.com/resources/tutorials', '', false, '_blank'));
    $menu->addChild(new JMenuNode('Videos', 'http://www.seblod.com/resources/videos', '', false, '_blank'));
    $menu->getParent();
} elseif ($mode == 3) {
    if ($user->authorise('core.manage', 'com_cck_ecommerce')) {
        $empty = false;
        $uix_ecommerce = JCckEcommerce::getUIX();
        $product_manager = JComponentHelper::getParams('com_cck_ecommerce')->get('product_manager_link');
        $menu->addChild(new JMenuNode(JText::_('MOD_CCK_MENU_CART_MANAGER'), 'index.php?option=com_cck_ecommerce&view=carts'));
        if ($uix_ecommerce == 'full') {
            $menu->addChild(new JMenuNode(JText::_('MOD_CCK_MENU_ORDER_MANAGER'), 'index.php?option=com_cck_ecommerce&view=orders'));
            if ($options['ecommerce']) {
                $menu->addChild(new JMenuNode(JText::_('MOD_CCK_MENU_PAYMENT_MANAGER'), 'index.php?option=com_cck_ecommerce&view=payments'));
            }
            if ($product_manager) {
                $menu->addChild(new JMenuNode(JText::_('MOD_CCK_MENU_PRODUCT_MANAGER'), $product_manager));
            }
            if ($options['ecommerce']) {
                $menu->addChild(new JMenuNode(JText::_('MOD_CCK_MENU_SHIPPING_MANAGER'), 'index.php?option=com_cck_ecommerce&view=shippings'));
            }
            $menu->addChild(new JMenuNode(JText::_('MOD_CCK_MENU_STORE_MANAGER'), 'index.php?option=com_cck_ecommerce&view=stores'));
        }
Exemple #8
0
 public static function count($type)
 {
     return count(JCckEcommerce::getPromotions($type));
 }