當前位置: 首頁>>代碼示例>>PHP>>正文


PHP J2Store類代碼示例

本文整理匯總了PHP中J2Store的典型用法代碼示例。如果您正苦於以下問題:PHP J2Store類的具體用法?PHP J2Store怎麽用?PHP J2Store使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了J2Store類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

 /**
  *
  * @return unknown_type
  */
 public function display($articleid)
 {
     $html = '';
     if (empty($articleid)) {
         return;
     }
     //try loading language associations
     if (version_compare(JVERSION, '3.3', 'gt')) {
         $id = $this->getAssociatedArticle($articleid);
         if ($id && is_int($id)) {
             $articleid = $id;
         }
     }
     $item = $this->getArticle($articleid);
     $mainframe = JFactory::getApplication();
     // Return html if the load fails
     if (!$item->id) {
         return $html;
     }
     $item->title = JFilterOutput::ampReplace($item->title);
     $item->text = '';
     $item->text = $item->introtext . chr(13) . chr(13) . $item->fulltext;
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     $params = $mainframe->getParams('com_content');
     $prepare_content = J2Store::config()->get('prepare_content', 0);
     if ($prepare_content) {
         $html .= JHtml::_('content.prepare', $item->text);
     } else {
         $html .= $item->text;
     }
     return $html;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:36,代碼來源:article.php

示例2: onDJCatalog2BeforeCart

 /**
  * Method to return j2store cart html
  * @param object $item
  * @return string
  */
 public function onDJCatalog2BeforeCart($itemObject, $params, $context)
 {
     if (!defined('F0F_INCLUDED')) {
         include_once JPATH_LIBRARIES . '/f0f/include.php';
     }
     $app = JFactory::getApplication();
     $option = $app->input->getString('option');
     if ($app->isSite() && $option == 'com_djcatalog2') {
         $html = '';
         $params = $this->params;
         $j2params = J2Store::config();
         $cache = JFactory::getCache();
         $cache->clean('com_j2store');
         if (isset($itemObject->id) && !empty($itemObject->id)) {
             $product = F0FTable::getAnInstance('Product', 'J2StoreTable');
             $product->reset();
             if ($product->get_product_by_source('com_djcatalog2', $itemObject->id)) {
                 $image_html = '';
                 if ($option == 'com_djcatalog2' && $context == 'items.items') {
                     $mainimage_width = $this->params->get('list_image_thumbnail_width', 120);
                     $additional_image_width = $this->params->get('list_product_additional_image_width', 80);
                     if ($this->params->get('category_product_options', 1) == 1) {
                         $html = $product->get_product_html();
                     } else {
                         $html = $product->get_product_html('without_options');
                     }
                     $show_image = $this->params->get('category_display_j2store_images', 1);
                     $image_type = $this->params->get('category_image_type', 'thumbnail');
                     //to set enable zoom option in category view
                     if ($this->params->get('category_enable_image_zoom', 1)) {
                         $this->params->set('item_enable_image_zoom', 1);
                         $images = $product->get_product_images_html($image_type, $this->params);
                     } else {
                         $this->params->set('item_enable_image_zoom', 0);
                         $images = $product->get_product_images_html($image_type, $this->params);
                     }
                 } else {
                     $html = $product->get_product_html();
                     //set the image width
                     $mainimage_width = $this->params->get('item_product_main_image_width', 120);
                     $additional_image_width = $this->params->get('item_product_additional_image_width', 100);
                     $show_image = $this->params->get('item_display_j2store_images', 1);
                     $image_type = $this->params->get('item_image_type', 'thumbnail');
                     $images = $product->get_product_images_html($image_type, $this->params);
                 }
                 //custom css to adjust the j2store product images width
                 $content = ".j2store-product-images .j2store-mainimage img ,.j2store-product-images .j2store-thumbnail-image img ,.upsell-product-image img , .cross-sell-product-image img {width:{$mainimage_width}px} .j2store-img-responsive  { width :{$additional_image_width}px;}";
                 JFactory::getDocument()->addStyleDeclaration($content);
                 if ($show_image && $images !== false) {
                     $image_html = $images;
                 }
                 if ($html === false) {
                     $html = '';
                 }
                 $html = $image_html . $html;
             }
         }
     }
     return $html;
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:65,代碼來源:j2storedjcatalog2.php

示例3: onBeforeBrowse

 protected function onBeforeBrowse()
 {
     $db = JFactory::getDbo();
     $config = J2Store::config();
     $installation_complete = $config->get('installation_complete', 0);
     if (!$installation_complete) {
         //installation not completed
         JFactory::getApplication()->redirect('index.php?option=com_j2store&view=postconfig');
     }
     //first check if the currency table has a default records at least.
     $rows = F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->enabled(1)->getList();
     if (count($rows) < 1) {
         //no records found. Dumb default data
         F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->create_currency_by_code('USD', 'USD');
     }
     //update schema
     $dbInstaller = new F0FDatabaseInstaller(array('dbinstaller_directory' => JPATH_ADMINISTRATOR . '/components/com_j2store/sql/xml'));
     $dbInstaller->updateSchema();
     //update cart table
     $cols = $db->getTableColumns('#__j2store_carts');
     $cols_to_delete = array('product_id', 'vendor_id', 'variant_id', 'product_type', 'product_options', 'product_qty');
     foreach ($cols_to_delete as $key) {
         if (array_key_exists($key, $cols)) {
             $db->setQuery('ALTER TABLE #__j2store_carts DROP COLUMN ' . $key);
             try {
                 $db->execute();
             } catch (Exception $e) {
                 echo $e->getMessage();
             }
         }
     }
     return parent::onBeforeBrowse();
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:33,代碼來源:cpanels.php

示例4: saveOne

 public function saveOne($metakey, $value)
 {
     $db = JFactory::getDbo();
     $config = J2Store::config();
     $query = 'REPLACE INTO #__j2store_configurations (config_meta_key,config_meta_value) VALUES ';
     jimport('joomla.filter.filterinput');
     $filter = JFilterInput::getInstance(null, null, 1, 1);
     $conditions = array();
     if (is_array($value)) {
         $value = implode(',', $value);
     }
     // now clean up the value
     if ($metakey == 'store_billing_layout' || $metakey == 'store_shipping_layout' || $metakey == 'store_payment_layout') {
         $value = $app->input->get($metakey, '', 'raw');
         $clean_value = $filter->clean($value, 'html');
     } else {
         $clean_value = $filter->clean($value, 'string');
     }
     $config->set($metakey, $clean_value);
     $conditions[] = '(' . $db->q(strip_tags($metakey)) . ',' . $db->q($clean_value) . ')';
     $query .= implode(',', $conditions);
     try {
         $db->setQuery($query);
         $db->execute();
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:29,代碼來源:config.php

示例5: sendVouchers

 public function sendVouchers($cids)
 {
     $app = JFactory::getApplication();
     $config = JFactory::getConfig();
     $params = J2Store::config();
     $sitename = $config->get('sitename');
     $emailHelper = J2Store::email();
     $mailfrom = $config->get('mailfrom');
     $fromname = $config->get('fromname');
     $failed = 0;
     foreach ($cids as $cid) {
         $voucherTable = F0FTable::getAnInstance('Voucher', 'J2StoreTable')->getClone();
         $voucherTable->load($cid);
         $mailer = JFactory::getMailer();
         $mailer->setSender(array($mailfrom, $fromname));
         $mailer->isHtml(true);
         $mailer->addRecipient($voucherTable->email_to);
         $mailer->setSubject($voucherTable->subject);
         // parse inline images before setting the body
         $emailHelper->processInlineImages($voucherTable->email_body, $mailer);
         $mailer->setBody($voucherTable->email_body);
         //Allow plugins to modify
         J2Store::plugin()->event('BeforeSendVoucher', array($voucherTable, &$mailer));
         if ($mailer->Send() !== true) {
             $this->setError(JText::sprintf('J2STORE_VOUCHERS_SENDING_FAILED_TO_RECEIPIENT', $voucherTable->email_to));
             $failed++;
         }
         J2Store::plugin()->event('AfterSendVoucher', array($voucherTable, &$mailer));
         $mailer = null;
     }
     if ($failed > 0) {
         return false;
     }
     return true;
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:35,代碼來源:vouchers.php

示例6: onAdd

 protected function onAdd($tpl = null)
 {
     $app = JFactory::getApplication();
     JRequest::setVar('hidemainmenu', true);
     $model = $this->getModel();
     $this->item = $model->runMyBehaviorFlag(true)->getItem();
     $this->currency = J2Store::currency();
     $this->form_prefix = $this->input->getString('form_prefix', '');
     $this->product_source_view = $this->input->getString('product_source_view', 'article');
     $this->product_types = JHtml::_('select.genericlist', $model->getProductTypes(), $this->form_prefix . '[product_type]', array(), 'value', 'text', $this->item->product_type);
     if ($this->item->j2store_product_id) {
         //manufacturers
         $this->manufacturers = J2Html::select()->clearState()->type('genericlist')->name($this->form_prefix . '[manufacturer_id]')->value($this->item->manufacturer_id)->setPlaceHolders(array('' => JText::_('J2STORE_SELECT_OPTION')))->hasOne('Manufacturers')->setRelations(array('fields' => array('key' => 'j2store_manufacturer_id', 'name' => array('company'))))->getHtml();
         //vendor
         $this->vendors = J2Html::select()->clearState()->type('genericlist')->name($this->form_prefix . '[vendor_id]')->value($this->item->vendor_id)->setPlaceHolders(array('' => JText::_('J2STORE_SELECT_OPTION')))->hasOne('Vendors')->setRelations(array('fields' => array('key' => 'j2store_vendor_id', 'name' => array('first_name', 'last_name'))))->getHtml();
         //tax profiles
         $this->taxprofiles = J2Html::select()->clearState()->type('genericlist')->name($this->form_prefix . '[taxprofile_id]')->value($this->item->taxprofile_id)->setPlaceHolders(array('' => JText::_('J2STORE_NOT_TAXABLE')))->hasOne('Taxprofiles')->setRelations(array('fields' => array('key' => 'j2store_taxprofile_id', 'name' => 'taxprofile_name')))->getHtml();
     }
     if ($this->item->j2store_product_id > 0) {
         $this->product_filters = F0FTable::getAnInstance('ProductFilter', 'J2StoreTable')->getFiltersByProduct($this->item->j2store_product_id);
     } else {
         $this->product_filters = array();
     }
     return true;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:25,代碼來源:view.html.php

示例7: save

 /**
  * Method to save data
  * (non-PHPdoc)
  * @see F0FController::save()
  */
 public function save()
 {
     //security check
     JSession::checkToken() or die('Invalid Token');
     $app = JFactory::getApplication();
     $model = $this->getModel('configurations');
     $data = $app->input->getArray($_POST);
     $task = $this->getTask();
     $token = JSession::getFormToken();
     unset($data['option']);
     unset($data['task']);
     unset($data['view']);
     unset($data[$token]);
     if ($task == 'populatedata') {
         $this->getPopulatedData($data);
     }
     $db = JFactory::getDbo();
     $config = J2Store::config();
     $query = 'REPLACE INTO #__j2store_configurations (config_meta_key,config_meta_value) VALUES ';
     jimport('joomla.filter.filterinput');
     $filter = JFilterInput::getInstance(null, null, 1, 1);
     $conditions = array();
     foreach ($data as $metakey => $value) {
         if (is_array($value)) {
             $value = implode(',', $value);
         }
         //now clean up the value
         if ($metakey == 'store_billing_layout' || $metakey == 'store_shipping_layout' || $metakey == 'store_payment_layout') {
             $value = $app->input->get($metakey, '', 'raw');
             $clean_value = $filter->clean($value, 'html');
         } else {
             $clean_value = $filter->clean($value, 'string');
         }
         $config->set($metakey, $clean_value);
         $conditions[] = '(' . $db->q(strip_tags($metakey)) . ',' . $db->q($clean_value) . ')';
     }
     $query .= implode(',', $conditions);
     try {
         $db->setQuery($query);
         $db->execute();
         //update currencies
         F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->updateCurrencies(false);
         $msg = JText::_('J2STORE_CHANGES_SAVED');
     } catch (Exception $e) {
         $msg = $e->getMessage();
         $msgType = 'Warning';
     }
     switch ($task) {
         case 'apply':
             $url = 'index.php?option=com_j2store&view=configuration';
             break;
         case 'populatedata':
             $url = 'index.php?option=com_j2store&view=configuration';
             break;
         case 'save':
             $url = 'index.php?option=com_j2store&view=cpanels';
             break;
     }
     $this->setRedirect($url, $msg, $msgType);
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:65,代碼來源:configurations.php

示例8: onBeforeDelete

 protected function onBeforeDelete($oid)
 {
     $status = true;
     // load cart items
     $query = $this->_db->getQuery(true);
     $query->select('*')->from('#__j2store_cartitems')->where('cart_id = ' . (int) $oid);
     $this->_db->setQuery($query);
     try {
         $items = $this->_db->loadObjectList();
         // foreach orderitem
         foreach ($items as $item) {
             // remove from user's cart
             if (!F0FTable::getAnInstance('Cartitem', 'J2StoreTable')->delete($item->j2store_cartitem_id)) {
                 //F0FTable::getAnInstance ( 'Cartitem', 'J2StoreTable' )->getError();
                 break;
                 return false;
             } else {
                 J2Store::plugin()->event('RemoveCartItem', array($item));
                 $status = true;
             }
         }
     } catch (Exception $e) {
         // do nothing
     }
     return $status;
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:26,代碼來源:cart.php

示例9: getInfo

 public function getInfo()
 {
     $info = array();
     $version = new JVersion();
     $platform = new JPlatform();
     $db = JFactory::getDbo();
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $sf = $_SERVER['SERVER_SOFTWARE'];
     } else {
         $sf = getenv('SERVER_SOFTWARE');
     }
     $info['php'] = php_uname();
     $info['dbversion'] = $db->getVersion();
     $info['dbcollation'] = $db->getCollation();
     $info['phpversion'] = phpversion();
     $info['server'] = $sf;
     $info['sapi_name'] = php_sapi_name();
     $info['version'] = $version->getLongVersion();
     $info['platform'] = $platform->getLongVersion();
     $info['useragent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
     $info['j2store_version'] = $this->getJ2storeVerion();
     $info['is_pro'] = J2Store::isPro();
     $info['curl'] = $this->_isCurl();
     $info['json'] = $this->_isJson();
     $config = JFactory::getConfig();
     $info['error_reporting'] = $config->get('error_reporting');
     $caching = $config->get('caching');
     $info['caching'] = $caching ? JText::_('J2STORE_ENABLED') : JText::_('J2STORE_DISABLED');
     $cache_plugin = JPluginHelper::isEnabled('system', 'cache');
     $info['plg_cache_enabled'] = $cache_plugin;
     $info['memory_limit'] = ini_get('memory_limit');
     return $info;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:33,代碼來源:app_diagnostics.php

示例10: buildQuery

 public function buildQuery($overrideLimits = false)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('#__j2store_product_prices.*')->from('#__j2store_product_prices');
     $this->_buildQueryWhere($query);
     $this->_buildQueryOrder($query);
     J2Store::plugin()->event('ProductPricesAfterBuildQuery', array(&$query, &$this));
     return $query;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:9,代碼來源:productprices.php

示例11: onBeforeStore

 protected function onBeforeStore($updateNulls = false)
 {
     if (!isset($this->sku) || empty($this->sku)) {
         //sku is empty. Auto generate it based on product name
         $product_helper = J2Store::product();
         $this->sku = $product_helper->generateSKU($this);
     }
     return parent::onBeforeStore($updateNulls);
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:9,代碼來源:variant.php

示例12: addCSS

 public static function addCSS()
 {
     $app = JFactory::getApplication();
     $j2storeparams = J2Store::config();
     $document = JFactory::getDocument();
     if ($app->isAdmin()) {
         // always load namespaced bootstrap
         // $document->addStyleSheet(JURI::root(true).'/media/j2store/css/bootstrap.min.css');
     }
     if (!version_compare(JVERSION, '3.0', 'ge')) {
         // for site side, check if the param is enabled.
         if ($app->isSite() && $j2storeparams->get('load_bootstrap', 1)) {
             $document->addStyleSheet(JURI::root(true) . '/media/j2store/css/bootstrap.min.css');
         }
     }
     // jquery UI css
     $ui_location = $j2storeparams->get('load_jquery_ui', 3);
     switch ($ui_location) {
         case '0':
             // load nothing
             break;
         case '1':
             if ($app->isSite()) {
                 $document->addStyleSheet(JURI::root(true) . '/media/j2store/css/jquery-ui-custom.css');
             }
             break;
         case '2':
             if ($app->isAdmin()) {
                 $document->addStyleSheet(JURI::root(true) . '/media/j2store/css/jquery-ui-custom.css');
             }
             break;
         case '3':
         default:
             $document->addStyleSheet(JURI::root(true) . '/media/j2store/css/jquery-ui-custom.css');
             break;
     }
     if ($app->isAdmin()) {
         $document->addStyleSheet(JURI::root(true) . '/media/j2store/css/j2store_admin.css');
     } else {
         $document->addStyleSheet(JUri::root() . 'media/j2store/css/font-awesome.min.css');
         // Add related CSS to the <head>
         if ($document->getType() == 'html' && $j2storeparams->get('j2store_enable_css')) {
             $template = self::getDefaultTemplate();
             jimport('joomla.filesystem.file');
             // j2store.css
             if (JFile::exists(JPATH_SITE . '/templates/' . $template . '/css/j2store.css')) {
                 $document->addStyleSheet(JURI::root(true) . '/templates/' . $template . '/css/j2store.css');
             } else {
                 $document->addStyleSheet(JURI::root(true) . '/media/j2store/css/j2store.css');
             }
         } else {
             $document->addStyleSheet(JURI::root(true) . '/media/j2store/css/j2store.css');
         }
     }
 }
開發者ID:jputz12,項目名稱:OneNow-Vshop,代碼行數:55,代碼來源:strapper.php

示例13: onDisplay

 protected function onDisplay($tpl = null)
 {
     $app = JFactory::getApplication();
     $session = JFactory::getSession();
     $user = JFactory::getUser();
     $view = $this->input->getCmd('view', 'checkout');
     $this->params = J2Store::config();
     $this->currency = J2Store::currency();
     $this->storeProfile = J2Store::storeProfile();
     $this->user = $user;
     return true;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:12,代碼來源:view.html.php

示例14: onBrowse

 public function onBrowse($tpl = null)
 {
     $systemPlugin = JPluginHelper::isEnabled('system', 'j2store');
     if (!$systemPlugin) {
         //System plugin disabled. Manually enable it
         J2Store::plugin()->enableJ2StorePlugin();
     }
     $this->assign('systemPlugin', $systemPlugin);
     $this->assign('cachePlugin', JPluginHelper::isEnabled('system', 'cache'));
     $this->assign('params', J2Store::config());
     return true;
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:12,代碼來源:view.html.php

示例15: read

 function read()
 {
     // Makes sure SiteGround's SuperCache doesn't cache the subscription page
     J2Store::utilities()->nocache();
     $app = JFactory::getApplication();
     $app->setHeader('X-Cache-Control', 'False', true);
     $method = $app->input->getCmd('method', 'none');
     $model = $this->getModel('Callback');
     $result = $model->runCallback($method);
     echo $result ? 'OK' : 'FAILED';
     $app->close();
 }
開發者ID:davetheapple,項目名稱:oakencraft,代碼行數:12,代碼來源:callback.php


注:本文中的J2Store類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。