Exemplo n.º 1
0
 public function productcategories($categories)
 {
     $cats = array();
     $categories = explode("/", $categories);
     foreach ($categories as $categoryid) {
         $category = ProductsCategories::find($categoryid, "name, uri", true);
         if (!empty($category[0])) {
             $cats[] = array('uri' => "/categories/" . $category[0]['uri'] . ".html", 'name' => $category[0]['name']);
         }
     }
     $this->view->categories = $cats;
     return $this->view->render('partials/productcategories.phtml');
 }
Exemplo n.º 2
0
 /**
  * Export the products by the Google Product Atom Export
  * @author Shine Software
  * @return xml 
  */
 public function googleproductsAction()
 {
     // Calling Google Product Extension
     Zend_Feed_Writer::addPrefixPath('Shineisp_Feed_Writer_Extension_', 'Shineisp/Feed/Writer/Extension/');
     Zend_Feed_Writer::registerExtension('Google');
     $isp = Shineisp_Registry::get('ISP');
     $feed = new Zend_Feed_Writer_Feed();
     $feed->setTitle($isp->company);
     $feed->setLink($isp->website);
     $feed->setFeedLink($isp->website . '/atom/products', 'atom');
     $feed->addAuthor(array('name' => $isp->manager, 'email' => $isp->email, 'uri' => $isp->website));
     $feed->setDateModified(time());
     $feed->setGenerator("ShineISP Atom Extension");
     $products = Products::getAllRss();
     // 		print_r($products);
     // 		die;
     foreach ($products as $product) {
         // Get the google categories
         $categories = ProductsCategories::getGoogleCategories($product['categories']);
         $cattype = Products::get_text_categories($product['categories']);
         // Create the product entries
         $entry = $feed->createEntry();
         $entry->setTitle($product['ProductsData'][0]['name']);
         $entry->setProductType(Products::get_text_categories($product['categories']));
         $entry->setBrand($isp->company);
         $entry->setAvailability(true);
         $entry->setLink($isp->website . "/" . $product['uri'] . ".html");
         // Custom Attributes Google Product Extension
         if (!empty($product['ProductsMedia'][0]['path'])) {
             $entry->setImageLink($isp->website . str_replace(" ", "%20", $product['ProductsMedia'][0]['path']));
         }
         if (!empty($product['uri'])) {
             $entry->setProductId($product['uri']);
         }
         if (!empty($categories[0]['googlecategs'])) {
             $entry->setCategory($categories[0]['googlecategs']);
         }
         $price = Products::getPriceSuggested($product['product_id'], true);
         $entry->setPrice($price);
         $entry->setCondition('new');
         $entry->setDateModified(time());
         $entry->setDescription(strip_tags($product['ProductsData'][0]['shortdescription']));
         $feed->addEntry($entry);
     }
     $feed = $feed->export('atom');
     // Feed Fixing for google products
     $feed = $this->googlefixes($feed);
     Shineisp_Commons_Utilities::writefile($feed, "documents", "googleproducts.xml");
     die($feed);
 }
Exemplo n.º 3
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'target_path', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Target Path'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'request_path', array('filters' => array('StringTrim'), 'label' => $translate->_('Request Path'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12'));
     $this->addElement('select', 'product_id', array('filters' => array('StringTrim'), 'label' => $translate->_('Products'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('product_id')->setAllowEmpty(false)->setMultiOptions(Products::getList(true));
     $this->addElement('select', 'category_id', array('filters' => array('StringTrim'), 'label' => $translate->_('Categories'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('category_id')->setAllowEmpty(false)->setMultiOptions(ProductsCategories::getList(true));
     $this->addElement('checkbox', 'temporary', array('filters' => array('StringTrim'), 'label' => $translate->_('Temporary'), 'decorators' => array('Bootstrap')));
     $this->addElement('hidden', 'url_rewrite_id');
 }
Exemplo n.º 4
0
 private function createCategoryTree($id)
 {
     $cats = array();
     $isfolder = false;
     $items = ProductsCategories::getbyParentId($id);
     foreach ($items as $category) {
         $subcategory = $this->createCategoryTree($category['category_id']);
         $isfolder = $subcategory ? true : false;
         if ($subcategory) {
             $cats[] = array('key' => $category['category_id'], 'title' => $category['name'], 'isFolder' => $isfolder, 'children' => $subcategory);
         } else {
             $cats[] = array('key' => $category['category_id'], 'title' => $category['name']);
         }
     }
     return $cats;
 }
Exemplo n.º 5
0
 public function Show($parameters)
 {
     $view = new Zend_View();
     $view->addScriptPath('../library/Shineisp/Custom/views');
     $ns = new Zend_Session_Namespace();
     $languageID = Languages::get_language_id($ns->lang);
     $translator = Shineisp_Registry::getInstance()->Zend_Translate;
     if (!empty($parameters['category']) && is_numeric($parameters['category'])) {
         $id = $parameters['category'];
     } else {
         return "";
     }
     // Get the products
     $view->products = ProductsCategories::getProductListbyCatID($id, "p.product_id, p.uri as uri, pd.name as name, pd.shortdescription as description", $languageID);
     return $view->render('productlist.phtml');
 }
Exemplo n.º 6
0
 public function getproducts($uri)
 {
     $this->authenticate();
     if (empty($uri)) {
         throw new Shineisp_Api_Exceptions(400002, ":: 'uri' field");
         exit;
     }
     $infoCategory = ProductsCategories::getAllInfobyURI($uri);
     if (empty($infoCategory)) {
         throw new Shineisp_Api_Exceptions(400003, ":: uri=>'{$uri}' not category assigned");
         exit;
     }
     //get the first elemnt
     $infoCategory = array_shift($infoCategory);
     $categoryid = $infoCategory['category_id'];
     $products = ProductsCategories::getProductListbyCatID($categoryid);
     return $products;
 }
Exemplo n.º 7
0
 public function listAction()
 {
     $ns = new Zend_Session_Namespace();
     $products = array();
     // get the category uri
     $uri = $this->getRequest()->getParam('q');
     if (!empty($uri)) {
         // Save the path of the user
         $ns->lastcategory = $uri;
         // Get the category information
         $category = $this->categories->getAllInfobyURI($uri);
         if (!empty($category[0])) {
             $this->view->category = $category[0];
             // Get the subcategories
             $this->view->subcategory = ProductsCategories::getbyParentId($category[0]['category_id'], 1, true);
             // Set the Metatag information
             $this->view->headTitle()->prepend($category[0]['name']);
             if (!empty($category[0]['keywords'])) {
                 $this->view->headMeta()->setName('keywords', $category[0]['keywords']);
             }
             if (!empty($category[0]['description'])) {
                 $this->view->headMeta()->setName('description', $category[0]['description'] ? Shineisp_Commons_Utilities::truncate(strip_tags($category[0]['description'])) : '-');
             }
             $this->view->headertitle = $category[0]['name'];
             // Get the products information
             $fields = "pd.productdata_id as productdata_id, \n\t\t\t\t           pd.name as name, \n\t\t\t\t           pd.shortdescription as shortdescription, \n\t\t\t\t           pd.metakeywords as metakeywords, \n\t\t\t\t           pd.metadescription as metadescription, \n\t\t\t\t           p.*, pag.code as groupcode";
             $data = $this->categories->getProductListbyCatUri($uri, $fields, $ns->langid);
             if (!empty($data['records'])) {
                 // Get the media information for each product
                 foreach ($data['records'] as $product) {
                     $product['reviews'] = Reviews::countItems($product['product_id']);
                     $product['attributes'] = ProductsAttributes::getAttributebyProductID($product['product_id'], $ns->langid, true);
                     $products[] = $product;
                 }
                 $this->view->products = $products;
                 $this->view->pager = $data['pager'];
             }
             $this->view->layoutmode = !empty($ns->layoutmode) ? $ns->layoutmode : "list";
             $this->_helper->viewRenderer($ns->layoutmode);
         } else {
             $this->_helper->redirector('index', 'index', 'default');
         }
     }
 }
Exemplo n.º 8
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'uri', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('URI'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'googlecategs', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Google Categories'), 'description' => $translate->_('See at http://support.google.com/merchants/bin/answer.py?hl=it&answer=1705911 for the list of the tassonomy'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'position', array('filters' => array('StringTrim'), 'label' => $translate->_('Position'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Description'), 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'keywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'class' => 'col-lg-12'));
     $this->addElement('select', 'parent', array('filters' => array('StringTrim'), 'label' => $translate->_('Parent Category'), 'description' => $translate->_('Select here the parent category.'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('parent')->setAllowEmpty(false)->setMultiOptions(ProductsCategories::getList(true));
     $this->addElement('multiselect', 'products', array('label' => $translate->_('Products'), 'description' => $translate->_('Select here the products to add to this category. Use Ctrl button to select more categories.'), 'decorators' => array('Bootstrap'), 'size' => 20, 'class' => 'form-control'));
     $this->getElement('products')->setAllowEmpty(false)->setMultiOptions(Products::getList());
     $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'label' => $translate->_('Blocks'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12'));
     $this->addElement('checkbox', 'enabled', array('label' => $translate->_('Enabled'), 'decorators' => array('Bootstrap'), 'class' => 'checkbox'));
     $this->addElement('multiselect', 'wikipages', array('label' => 'Wiki Pages', 'decorators' => array('Bootstrap'), 'class' => 'form-control multiselect'));
     $this->getElement('wikipages')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Wiki::getList());
     $this->addElement('submit', 'save', array('required' => false, 'label' => 'Save', 'decorators' => array('Bootstrap'), 'class' => 'btn'));
     $this->addElement('hidden', 'category_id');
 }
Exemplo n.º 9
0
 /**
  * menu
  * Create the menu
  * @param string $menucls - main CSS class
  */
 public function webmenu($menucls = "")
 {
     $this->translator = Shineisp_Registry::get('Zend_Translate');
     $NS = new Zend_Session_Namespace('Default');
     if (!empty($NS->customer)) {
         $this->view->user = $NS->customer;
     }
     // Get the store categories product
     $categories = ProductsCategories::getMenu();
     $storecategories = $this->storeCategoriesMenu($categories, 0);
     // Create CMS pages menu
     $cmsmenu = '<li class="dropdown"><a data-toggle="dropdown" href="">' . $this->translator->translate('Blog') . '</a>' . $this->createMenu(0) . "</li>";
     // Create the tlds list menu
     $tldmenu = $this->createTldMenu();
     // Delete the last </ul> in the list
     $storecategories = substr_replace($storecategories, "", -5);
     // Replace the header of the menu list
     $storecategories = substr_replace($storecategories, $tldmenu . $cmsmenu, 0, strlen("<ul class=''>"));
     // we will send the body of the bullet list to the partial template
     $this->view->menu = $storecategories;
     $this->view->menucls = $menucls;
     return $this->view->render('partials/webmenu.phtml');
 }
Exemplo n.º 10
0
 /**
  * export the content in a excel file
  * @param array $items
  */
 public function bulk_xml($items = array())
 {
     // Get the records from the customer table
     $data = self::get_products($items);
     $xml = new ExSimpleXMLElement('<shineisp></shineisp>');
     $products = $xml->addChild('products');
     foreach ($data as $item) {
         $product = $products->addChild('product');
         $product->addAttribute('id', $item['product_id']);
         $product->addChild('sku', $item['sku']);
         $product->addChild('inserted_at', $item['inserted_at']);
         $product->addChild('updated_at', $item['updated_at']);
         $product->addChild('price', $item['price_1']);
         $product->addChild('setupfee', $item['setupfee']);
         if (!empty($item['ProductsMedia'])) {
             $media = $product->addChild('media');
             foreach ($item['ProductsMedia'] as $productmedia) {
                 $file = $media->addChild('file');
                 $file->addAttribute('id', $productmedia['media_id']);
                 $file->addChildCData('name', $productmedia['filename']);
                 $file->addChildCData('description', $productmedia['description']);
                 $file->addChildCData('path', $productmedia['path']);
             }
         }
         if (!empty($item['categories'])) {
             $categories = $product->addChild('categories');
             $theCats = ProductsCategories::getCategoriesByIds($item['categories']);
             foreach ($theCats as $categ) {
                 $category = $categories->addChild('category');
                 $category->addAttribute('id', $categ['id']);
                 $category->addChildCData('name', $categ['name']);
                 $category->addChildCData('description', $categ['description']);
                 $category->addChild('uri', $categ['uri']);
             }
         }
         if (!empty($item['ProductsData'][0])) {
             $product->addChildCData('name', $item['ProductsData'][0]['name']);
             $product->addChildCData('shortdescription', $item['ProductsData'][0]['shortdescription']);
             $product->addChildCData('description', $item['ProductsData'][0]['description']);
             $product->addChildCData('metakeywords', $item['ProductsData'][0]['metakeywords']);
             $product->addChildCData('metadescription', $item['ProductsData'][0]['metadescription']);
         }
         if (!empty($item['ProductsAttributesGroups'])) {
             $product->addAttribute('groupcode', $item['ProductsAttributesGroups']['code']);
             $product->addAttribute('groupname', $item['ProductsAttributesGroups']['name']);
         }
         if (!empty($item['ProductsAttributesIndexes'])) {
             $attributes = $product->addChild('attributes');
             foreach ($item['ProductsAttributesIndexes'] as $attr) {
                 $attribute = $attributes->addChild('attribute');
                 $theAttr = ProductsAttributes::getAllInfo($attr['attribute_id'], "attribute_id, code, type, is_visible_on_front, position, pad.label, pad.description, pad.prefix, pad.suffix");
                 $attribute->addAttribute('id', $attr['attribute_id']);
                 $attribute->addChild('code', $theAttr['code']);
                 $attribute->addChildCData('name', $theAttr['ProductsAttributesData'][0]['label']);
                 $attribute->addChildCData('description', $theAttr['ProductsAttributesData'][0]['description']);
                 $attribute->addChildCData('prefix', $theAttr['ProductsAttributesData'][0]['prefix']);
                 $attribute->addChildCData('suffix', $theAttr['ProductsAttributesData'][0]['suffix']);
                 $attribute->addChildCData('value', $attr['value']);
                 $attribute->addChild('type', $theAttr['type']);
                 $attribute->addChild('is_visible_on_front', $theAttr['is_visible_on_front']);
                 $attribute->addChild('position', $theAttr['position']);
             }
         }
         if (!empty($item['ProductsTranches'])) {
             $prices = $product->addChild('prices');
             foreach ($item['ProductsTranches'] as $tranches) {
                 $price = $prices->addChild('price');
                 $price->addChild('quantity', $tranches['quantity']);
                 $price->addChild('price', $tranches['price']);
                 $price->addChild('measurement', $tranches['measurement']);
                 if (!empty($tranches['BillingCycle'])) {
                     $price->addAttribute('id', $tranches['BillingCycle']['billing_cycle_id']);
                     $price->addAttribute('name', $tranches['BillingCycle']['name']);
                     $price->addAttribute('months', $tranches['BillingCycle']['months']);
                 }
             }
         }
     }
     $xml->saveXML(PUBLIC_PATH . "/tmp/products.xml");
     if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
         die(json_encode(array('url' => "/tmp/products.xml")));
     }
 }
Exemplo n.º 11
0
 /**
  * Create the array category tree
  * @param string $uri
  */
 public static function createCategoryTree($id, $categoriesel = array())
 {
     $cats = array();
     $isfolder = false;
     $items = ProductsCategories::getbyParentId($id, 0);
     foreach ($items as $category) {
         $subcategory = self::createCategoryTree($category['category_id'], $categoriesel);
         $isfolder = $subcategory ? true : false;
         $selected = in_array($category['category_id'], $categoriesel) ? true : false;
         if ($subcategory) {
             $expanded = in_array($category['category_id'], $categoriesel) ? true : false;
             $cats[] = array('key' => $category['category_id'], 'title' => $category['name'], 'expand' => $expanded, 'select' => $selected, 'isFolder' => $isfolder, 'children' => $subcategory);
         } else {
             $cats[] = array('key' => $category['category_id'], 'title' => $category['name'], 'select' => $selected);
         }
     }
     return $cats;
 }
 /**
  * Search the record for the Select2 JQuery Object by ajax
  * @return json
  */
 public function searchAction()
 {
     if ($this->getRequest()->isXmlHttpRequest()) {
         $term = $this->getParam('term');
         $id = $this->getParam('id');
         if (!empty($term)) {
             $term = "%{$term}%";
             $records = ProductsCategories::findbyName("(name LIKE ?)", $term);
             die(json_encode($records));
         }
         if (!empty($id)) {
             $records = ProductsCategories::get_by_id($id);
             die(json_encode($records));
         }
         $records = ProductsCategories::getAll();
         die(json_encode($records));
     } else {
         die;
     }
 }
Exemplo n.º 13
0
 /**
  * Get products using the categories
  * 
  * @return Json
  */
 public function getproductsAction()
 {
     $id = $this->getRequest()->getParam('id');
     $products = array();
     if (is_numeric($id)) {
         $products = ProductsCategories::getProductListbyCatID($id, "p.product_id, pd.name as name");
     }
     die(json_encode($products));
 }
Exemplo n.º 14
0
 public function init()
 {
     // Set the custom decorator
     $this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
     $translate = Shineisp_Registry::get('Zend_Translate');
     $this->addElement('text', 'name', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Product name'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'nickname', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Product Nickname'), 'description' => $translate->_('This is the short name of the product'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'uri', array('filters' => array('StringTrim'), 'label' => $translate->_('URI'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'sku', array('filters' => array('StringTrim'), 'label' => $translate->_('SKU'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'shortdescription', array('filters' => array('StringTrim'), 'label' => $translate->_('Short Description'), 'id' => 'shortdescription', 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('textarea', 'metakeywords', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Keywords'), 'rows' => 5, 'class' => 'col-lg-12 form-control'));
     $this->addElement('textarea', 'metadescription', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Meta Description'), 'rows' => 5, 'class' => 'col-lg-12 form-control'));
     $this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'id' => 'description', 'class' => 'col-lg-12 form-control wysiwyg'));
     $this->addElement('select', 'category_id', array('label' => $translate->_('Category'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('category_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ProductsCategories::getList());
     $this->addElement('select', 'welcome_mail_id', array('label' => $translate->_('Welcome E-Mail'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('welcome_mail_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(EmailsTemplates::getList());
     $this->addElement('select', 'server_group_id', array('label' => $translate->_('Server group'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('server_group_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ServersGroups::getList(true));
     $this->addElement('select', 'autosetup', array('label' => $translate->_('Automatic setup'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('autosetup')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(array('0' => 'Do not automatically setup this product', '1' => 'Automatically setup the product as soon as an order is placed', '2' => 'Automatically setup the product as soon as the first payment is received', '3' => 'Automatically setup the product when you manually accept a pending order', '4' => 'Automatically setup the product as soon as the payment is complete'));
     $this->addElement('multiselect', 'related', array('label' => $translate->_('Related Products'), 'decorators' => array('Bootstrap'), 'size' => '20x', 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->addElement('multiselect', 'upgrade', array('label' => $translate->_('Product Upgrades'), 'decorators' => array('Bootstrap'), 'size' => '20x', 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('related')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Products::getList());
     $this->getElement('upgrade')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Products::getList());
     $this->addElement('select', 'tax_id', array('label' => 'Tax', 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('tax_id')->setAllowEmpty(false)->setMultiOptions(Taxes::getList(true));
     $this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'price_1', array('filters' => array('StringTrim'), 'label' => $translate->_('Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup Fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('textarea', 'setup', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup'), 'decorators' => array('Bootstrap'), 'description' => $translate->_('XML Setup Configuration. See the manual'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('select', 'enabled', array('label' => $translate->_('Enabled'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'Disabled', '1' => 'Active')));
     $this->addElement('select', 'ishighlighted', array('label' => $translate->_('Is Highlighted'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'isrefundable', array('label' => $translate->_('Is Refundable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'default', array('label' => $translate->_('Default Image'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'iscomparable', array('label' => $translate->_('Is Comparable'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'showonrss', array('label' => $translate->_('Publish on RSS Feed'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'downgradable', array('label' => $translate->_('Allow downgrades'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('0' => 'No', '1' => 'Yes')));
     $this->addElement('select', 'type', array('label' => $translate->_('Product Type'), 'decorators' => array('Bootstrap'), 'class' => 'form-control', 'multioptions' => array('generic' => $translate->_('Generic'), 'domain' => $translate->_('Domain'), 'hosting' => $translate->_('Hosting'))));
     // If the browser client is an Apple client hide the file upload html object
     if (false == Shineisp_Commons_Utilities::isAppleClient()) {
         $this->addElement('text', 'filedescription', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
         $MBlimit = Settings::findbyParam('adminuploadlimit');
         $Byteslimit = Shineisp_Commons_Utilities::MB2Bytes($MBlimit);
         $filetypes = Settings::findbyParam('adminuploadfiletypes', 'Admin');
         $file = $this->createElement('file', 'attachments', array('label' => $translate->_('Attachment'), 'decorators' => array('File', array('ViewScript', array('viewScript' => 'partials/file.phtml', 'placement' => false))), 'description' => $translate->_('Select the document to upload. Files allowed are (%s) - Max %s', $filetypes, Shineisp_Commons_Utilities::formatSizeUnits($Byteslimit)), 'data-classButton' => 'btn btn-primary', 'data-input' => 'false', 'class' => 'filestyle'));
         $file->addValidator('Extension', false, $filetypes)->addValidator('Size', false, $Byteslimit)->addValidator('Count', false, 1);
         $this->addElement($file);
     }
     $this->addElement('multiselect', 'wikipages', array('label' => $translate->_('Wiki Pages'), 'decorators' => array('Bootstrap'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('wikipages')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Wiki::getList());
     $this->addElement('select', 'tranche_billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->getElement('tranche_billing_cycle_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(BillingCycle::getList());
     $this->addElement('text', 'tranche_qty', array('filters' => array('StringTrim'), 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'tranche_measure', array('filters' => array('StringTrim'), 'label' => $translate->_('Measurement label'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'tranche_setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fee'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('text', 'tranche_price', array('filters' => array('StringTrim'), 'label' => $translate->_('Unit Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
     $this->addElement('multiselect', 'tranche_includes_domains', array('isArray' => true, 'label' => $translate->_('Domain included'), 'decorators' => array('Bootstrap'), 'title' => $translate->_('Select ...'), 'data-container' => 'body', 'data-selected-text-format' => 'count > 2', 'data-size' => 'auto', 'data-live-search' => 'true', 'class' => 'multiselect show-tick col-md-4'));
     $this->getElement('tranche_includes_domains')->setAllowEmpty(true)->setRegisterInArrayValidator(false)->setMultiOptions(DomainsTlds::getList());
     $this->addElement('select', 'group_id', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Attribute Group'), 'required' => true, 'class' => 'form-control'));
     $this->getElement('group_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(ProductsAttributesGroups::getList());
     $this->addElement('text', 'position', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Position'), 'class' => 'form-control'));
     $this->addElement('textarea', 'blocks', array('filters' => array('StringTrim'), 'label' => $translate->_('Blocks'), 'decorators' => array('Bootstrap'), 'class' => 'col-lg-12 form-control'));
     $this->addElement('hidden', 'product_id');
 }
Exemplo n.º 15
0
 /**
  * Get the text list of the categories
  *  
  * @param integer $index
  */
 public static function get_text_categories($categories)
 {
     $items = array();
     $categories = ProductsCategories::getCategoriesInfo($categories);
     foreach ($categories as $category) {
         $items[] = $category['name'];
     }
     return implode(" > ", $items);
 }