Beispiel #1
1
 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;
 }
 /**
  * Method to get Related products
  *
  */
 public function getRelatedProducts()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDbo();
     $q = $app->input->post->getString('q');
     $ignore_product_id = $app->input->getInt('product_id');
     $json = array();
     $model = $this->getModel('Products');
     $model->setState('search', $q);
     $query = $db->getQuery(true);
     $query->select('#__j2store_products.j2store_product_id')->from("#__j2store_products as #__j2store_products");
     $query->where('#__j2store_products.enabled=1');
     $query->where('#__j2store_products.j2store_product_id !=' . $db->q($ignore_product_id));
     J2Store::plugin()->importCatalogPlugins();
     JFactory::getApplication()->triggerEvent('onJ2StoreAfterProductListQuery', array(&$query, &$model));
     $db->setQuery($query);
     $items = $db->loadObjectList();
     $result = array();
     if (isset($items) && !empty($items)) {
         foreach ($items as $key => $item) {
             if ($item->product_name) {
                 $result[$key]['j2store_product_id'] = $item->j2store_product_id;
                 $result[$key]['product_name'] = $item->product_name;
             }
         }
     }
     $json['products'] = $result;
     echo json_encode($json);
     $app->close();
 }
Beispiel #3
0
 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;
 }
 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;
 }
Beispiel #5
0
 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;
 }
 public function getStockProductListQuery($overrideLimits = false)
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->select('#__j2store_productquantities.*')->from('#__j2store_productquantities');
     $this->_buildQueryJoins($query);
     $this->_buildWhereQuery($query);
     $this->_buildQueryOrderBy($query);
     $query->group('#__j2store_products.j2store_product_id');
     //$query->group('#__j2store_productquantities.variant_id');
     J2Store::plugin()->event('AfterStockProductListQuery', array(&$query, &$this));
     return $query;
 }
 public function calculate()
 {
     $variant = $this->get('variant');
     $quantity = $this->get('quantity');
     $date = $this->get('date');
     $group_id = $this->get('group_id');
     $pricing = new JObject();
     //set the base price
     $pricing->base_price = $variant->price;
     $pricing->price = $variant->price;
     $pricing->calculator = 'standard';
     //see if we have advanced pricing for this product / variant
     $model = F0FModel::getTmpInstance('ProductPrices', 'J2StoreModel');
     J2Store::plugin()->event('BeforeGetPrice', array(&$pricing, &$model));
     $model->setState('variant_id', $variant->j2store_variant_id);
     //where quantity_from < $quantity
     $model->setState('filter_quantity', $quantity);
     $tz = JFactory::getConfig()->get('offset');
     // does date even matter?
     $nullDate = JFactory::getDBO()->getNullDate();
     if (empty($date) || $date == $nullDate) {
         $date = JFactory::getDate('now', $tz)->toSql(true);
     }
     //where date_from <= $date
     //where date_to >= $date OR date_to == nullDate
     $model->setState('filter_date', $date);
     // does group_id?
     $user = JFactory::getUser();
     if (empty($group_id)) {
         $group_id = implode(',', JAccess::getGroupsByUser($user->id));
     }
     //if(empty($group_id)) $group_id = implode(',', JAccess::getAuthorisedViewLevels($user->id));
     $model->setState('group_id', $group_id);
     // set the ordering so the most discounted item is at the top of the list
     $model->setState('orderby', 'quantity_from');
     $model->setState('direction', 'DESC');
     try {
         $price = $model->getItem();
         //var_dump($price);
     } catch (Exception $e) {
         $price = new stdClass();
     }
     if (isset($price->price)) {
         $pricing->special_price = $price->price;
         //this is going to be the sale price
         $pricing->price = $price->price;
         $pricing->is_discount_pricing_available = $pricing->base_price > $pricing->price ? true : false;
     }
     return $pricing;
 }
Beispiel #8
0
 public function getShippingRates(&$order)
 {
     static $rates;
     if (empty($rates) || !is_array($rates)) {
         $rates = array();
     }
     if (!empty($rates)) {
         return $rates;
     }
     $app = JFactory::getApplication();
     JPluginHelper::importPlugin('j2store');
     $plugins = $this->enabled(1)->getList();
     $rates = array();
     if ($plugins) {
         foreach ($plugins as $plugin) {
             $shippingOptions = $app->triggerEvent("onJ2StoreGetShippingOptions", array($plugin->element, $order));
             if (in_array(true, $shippingOptions, true)) {
                 $results = $app->triggerEvent("onJ2StoreGetShippingRates", array($plugin->element, $order));
                 foreach ($results as $result) {
                     if (is_array($result)) {
                         foreach ($result as $r) {
                             $extra = 0;
                             // here is where a global handling rate would be added
                             //	if ($global_handling = $this->defines->get( 'global_handling' ))
                             //	{
                             //		$extra = $global_handling;
                             //	}
                             J2Store::plugin()->event('GetGlobalHandling', array($order, &$r, &$extra));
                             $r['extra'] += $extra;
                             $r['total'] += $extra;
                             $rates[] = $r;
                         }
                     }
                 }
             }
         }
     }
     //order by the cheapest method
     if (function_exists('usort') && count($rates)) {
         usort($rates, function ($a, $b) {
             return $a['total'] - $b['total'];
         });
     }
     return $rates;
 }
Beispiel #9
0
 function addAddress($type = 'billing', $data = array())
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     if (isset($data) && count($data)) {
         $post = $data;
     } else {
         $post = $app->input->getArray($_POST);
     }
     foreach ($post as $key => $value) {
         // in case the value is an array, store as a json encoded message
         if (is_array($value)) {
             $post[$key] = $db->escape(json_encode($value));
         }
     }
     // first save data to the address table
     $row = F0FTable::getInstance('Address', 'J2StoreTable');
     // set the id so that it updates the record rather than changing
     if (!$row->bind($post)) {
         $this->setError($row->getError());
         return false;
     }
     J2Store::plugin()->event('BeforeSaveAddress', array(&$row, $post));
     if ($user->id) {
         $row->user_id = $user->id;
         $row->email = $user->email;
     }
     $row->type = $type;
     if (!$row->store()) {
         $this->setError($row->getError());
         return false;
     }
     J2Store::plugin()->event('AfterSaveAddress', array(&$row, $post));
     return $row->j2store_address_id;
 }
Beispiel #10
0
  <div class="row">
  <div class="col-xs-11 shipping-make-same" style="clear: both; padding-top: 15px;">
	  <input type="checkbox" name="shipping_address" value="1" id="shipping" checked="checked" />
	  <label for="shipping"><?php 
    echo JText::_('J2STORE_MAKE_SHIPPING_SAME');
    ?>
</label>
  </div>
  </div> <!-- end of row -->
  <br />
  <?php 
}
?>

<?php 
echo J2Store::plugin()->eventWithHtml('CheckoutRegister', array($this));
?>
<div class="buttons">
  <div class="left">
    <input type="button" value="<?php 
echo JText::_('J2STORE_CHECKOUT_CONTINUE');
?>
" id="button-register" class="button btn btn-primary" />
  </div>
</div>
<input type="hidden" name="option" value="com_j2store" />
<input type="hidden" name="view" value="checkout" />
<input type="hidden" name="task" value="register_validate" />

</div> <!-- end of j2store -->
Beispiel #11
0
    echo JText::_('J2STORE_CHECKOUT_PASSWORD');
    ?>
</b><br />
		<input type="password" name="password" value="" />
		<br />
		<input type="button" value="<?php 
    echo JText::_('J2STORE_CHECKOUT_LOGIN');
    ?>
" id="button-login" class="button btn btn-primary" /><br />
		<input type="hidden" name="task" value="login_validate" />
		<input type="hidden" name="option" value="com_j2store" />
		<input type="hidden" name="view" value="checkout" />
		<br />
		<?php 
    $forgot_pass_link = JRoute::_('index.php?option=com_users&view=reset');
    ?>
		<a href="<?php 
    echo $forgot_pass_link;
    ?>
" target="_blank"><?php 
    echo JText::_('J2STORE_FORGOT_YOUR_PASSWORD');
    ?>
</a>
	</div>
</div>
<?php 
}
echo J2Store::plugin()->eventWithHtml('CheckoutLogin', array($this));
?>
<input type="hidden" name="option" value="com_j2store" />
<input type="hidden" name="view" value="checkout" />
Beispiel #12
0
"
				   />

	   </div>
	<?php 
} else {
    ?>
			<input value="<?php 
    echo JText::_('J2STORE_OUT_OF_STOCK');
    ?>
" type="button" class="j2store_button_no_stock btn btn-warning" />
	<?php 
}
?>

	<?php 
echo J2Store::plugin()->eventWithHtml('AfterAddToCartButton', array($this->product, J2Store::utilities()->getContext('view_cart')));
?>

	<input type="hidden" name="option" value="com_j2store" />
	<input type="hidden" name="view" value="carts" />
	<input type="hidden" name="task" value="addItem" />
	<input type="hidden" name="ajax" value="0" />
	<?php 
echo JHTML::_('form.token');
?>
	<input type="hidden" name="return" value="<?php 
echo base64_encode(JUri::getInstance()->toString());
?>
" />
	<div class="j2store-notifications"></div>
Beispiel #13
0
 public function validateOptionRules($value, $option, &$errors)
 {
     if ($option->type == 'date' || $option->type == 'datetime') {
         $tz = JFactory::getConfig()->get('offset');
         if (!empty($option->option_params)) {
             $params = new JRegistry($option->option_params);
         } else {
             $params = new JRegistry('{}');
         }
         if ($params->get('hide_pastdates', 0)) {
             $now = JFactory::getDate('now', $tz);
             $date = JFactory::getDate($value, $tz);
             $interval = $now->diff($date);
             //	print_r($interval);
             $val = (int) $interval->format('%R%a');
             //echo $interval->format('%R%a');
             if ($val < 0) {
                 $errors['error']['option'][$option->j2store_productoption_id] = JText::_('J2STORE_DATE_VALIDATION_ERROR_PAST_DATE');
             }
         }
     }
     J2Store::plugin()->event('ValidateOptionRules', array($value, $option, $errors));
 }
Beispiel #14
0
 public function onBeforeAddCartItem(&$model, $product, &$json)
 {
     $app = JFactory::getApplication();
     $product_helper = J2Store::product();
     $values = $app->input->getArray($_REQUEST);
     $errors = array();
     //run quantity check
     $quantity = $app->input->get('product_qty');
     if (isset($quantity)) {
         $quantity = $quantity;
     } else {
         $quantity = 1;
     }
     //get options
     //get the product options
     $options = $app->input->get('product_option', array(0), 'ARRAY');
     if (isset($options)) {
         $options = array_filter($options);
     } else {
         $options = array();
     }
     //iterate through stored options for this product and validate
     foreach ($product->product_options as $product_option) {
         //check option type should not be file
         if ($product_option->required && empty($options[$product_option->j2store_productoption_id])) {
             $errors['error']['option'][$product_option->j2store_productoption_id] = JText::sprintf('J2STORE_ADDTOCART_PRODUCT_OPTION_REQUIRED', $product_option->option_name);
         }
         if (!empty($options[$product_option->j2store_productoption_id])) {
             F0FModel::getTmpInstance('Options', 'J2StoreModel')->validateOptionRules($options[$product_option->j2store_productoption_id], $product_option, $errors);
         }
     }
     $cart = $model->getCart();
     if (!$errors && $cart->cart_type != 'wishlist') {
         //before validating, get the total quantity of this variant in the cart
         $cart_total_qty = $product_helper->getTotalCartQuantity($product->variants->j2store_variant_id);
         //validate minimum / maximum quantity
         $error = $product_helper->validateQuantityRestriction($product->variants, $cart_total_qty, $quantity);
         if (!empty($error)) {
             $errors['error']['stock'] = $error;
         }
         //validate inventory
         if ($product_helper->check_stock_status($product->variants, $cart_total_qty + $quantity) === false) {
             $errors['error']['stock'] = JText::_('J2STORE_OUT_OF_STOCK');
         }
     }
     if (!$errors) {
         //all good. Add the product to cart
         // create cart object out of item properties
         $item = new JObject();
         $item->user_id = JFactory::getUser()->id;
         $item->product_id = (int) $product->j2store_product_id;
         $item->variant_id = (int) $product->variants->j2store_variant_id;
         $item->product_qty = J2Store::utilities()->stock_qty($quantity);
         $item->product_options = base64_encode(serialize($options));
         $item->product_type = $product->product_type;
         $item->vendor_id = isset($product->vendor_id) ? $product->vendor_id : '0';
         // onAfterCreateItemForAddToCart: plugin can add values to the item before it is being validated /added
         // once the extra field(s) have been set, they will get automatically saved
         $results = J2Store::plugin()->event("AfterCreateItemForAddToCart", array($item, $values));
         foreach ($results as $result) {
             foreach ($result as $key => $value) {
                 $item->set($key, $value);
             }
         }
         // no matter what, fire this validation plugin event for plugins that extend the checkout workflow
         $results = array();
         $results = J2Store::plugin()->event("BeforeAddToCart", array($item, $values, $product, $product->product_options));
         foreach ($results as $result) {
             if (!empty($result['error'])) {
                 $errors['error']['general'] = $result['error'];
             }
         }
         // when there is some error from the plugin then the cart item should not be added
         if (!$errors) {
             //add item to cart
             $cartTable = $model->addItem($item);
             if ($cartTable === false) {
                 //adding to cart is failed
                 $errors['success'] = 0;
             } else {
                 //adding cart is successful
                 $errors['success'] = 1;
                 $errors['cart_id'] = $cartTable->j2store_cart_id;
             }
         }
     }
     $json->result = $errors;
 }
Beispiel #15
0
<?php

/**
 * @package J2Store
 * @copyright Copyright (c)2014-17 Ramesh Elamathi / J2Store.org
 * @license GNU GPL v3 or later
 */
// No direct access to this file
defined('_JEXEC') or die;
JHtml::_('behavior.modal');
$row = $this->item;
?>
	<?php 
$results = J2Store::plugin()->eventWithHtml('GetAppView', array($row));
?>
	<h3><?php 
echo JText::_($row->name);
?>
</h3>
	<?php 
echo $results;
Beispiel #16
0
							<span class="cart-product-sku">
								<span class="cart-item-title"><?php 
        echo JText::_('J2STORE_CART_LINE_ITEM_SKU');
        ?>
</span>
								<span class="cart-item-value"><?php 
        echo $item->orderitem_sku;
        ?>
</span>
							</span>

						<?php 
    }
    ?>
						<?php 
    echo J2Store::plugin()->eventWithHtml('AfterDisplayLineItemTitle', array($item, $this->order, $this->params));
    ?>
					</td>
					<td><?php 
    echo $item->orderitem_quantity;
    ?>
</td>
					<td class="cart-line-subtotal">
						<?php 
    echo $currency->format($this->order->get_formatted_lineitem_total($item, $this->params->get('checkout_price_display_options', 1)));
    ?>
					
					</td>
				</tr>
				<?php 
}
Beispiel #17
0
 function onContentPrepareForm($form, $data)
 {
     if (!defined('F0F_INCLUDED')) {
         require_once JPATH_LIBRARIES . '/f0f/include.php';
     }
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     J2Store::plugin()->event('BeforeContentPrepareForm', array($form, $data));
     // Check we are manipulating a valid form.
     $formName = $form->getName();
     if (!in_array($formName, array('com_content.article'))) {
         return true;
     }
     // Add the form path and fields to the form.
     JForm::addFormPath(dirname(__FILE__) . '/forms');
     JForm::addFieldPath(dirname(__FILE__) . '/fields');
     $form->loadFile('j2store', false);
     $app = JFactory::getApplication();
     if ($app->isSite()) {
         $article_id = $app->input->getInt('a_id');
         //if($article_id){
         $this->appendJ2StoreFieldset();
         //}
     }
     J2Store::plugin()->event('AfterContentPrepareForm', array($form, $data));
     return true;
 }
Beispiel #18
0
 /**
  * Method to process tags
  *
  * @param string $text Text to process
  * @param object $order TableOrder object
  * @param array $extras an array containing extra tags to process
  */
 public function processTags($text, $order, $extras = array())
 {
     $app = JFactory::getApplication();
     $params = J2Store::config();
     $currency = J2Store::currency();
     $order_model = F0FModel::getTmpInstance('Orders', 'J2StoreModel');
     // -- Get the site name
     $config = JFactory::getConfig();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $sitename = $config->get('sitename');
     } else {
         $sitename = $config->getValue('config.sitename');
     }
     //site url
     $baseURL = JURI::base();
     $subpathURL = JURI::base(true);
     //replace administrator string, if present
     $baseURL = str_replace('/administrator', '', $baseURL);
     $subpathURL = str_replace('/administrator', '', $subpathURL);
     //invoice url
     $url = str_replace('&amp;', '&', JRoute::_('index.php?option=com_j2store&view=myprofile'));
     $url = str_replace('/administrator', '', $url);
     $url = ltrim($url, '/');
     $subpathURL = ltrim($subpathURL, '/');
     if (substr($url, 0, strlen($subpathURL) + 1) == "{$subpathURL}/") {
         $url = substr($url, strlen($subpathURL) + 1);
     }
     $invoiceURL = rtrim($baseURL, '/') . '/' . ltrim($url, '/');
     //order date
     //$order_date = JHTML::_('date', $order->created_on, $params->get('date_format', JText::_('DATE_FORMAT_LC1')));
     $tz = JFactory::getConfig()->get('offset');
     $date = JFactory::getDate($order->created_on, $tz);
     $order_date = $date->format($params->get('date_format', JText::_('DATE_FORMAT_LC1')), true);
     //items table
     $items = $order_model->loadItemsTemplate($order);
     $invoice_number = $order->getInvoiceNumber();
     //now process tags
     $orderinfo = $order->getOrderInformation();
     $shipping = $order->getOrderShippingRate();
     $ordercoupon = $order->getOrderCoupons();
     $status = F0FModel::getTmpInstance('Orderstatuses', 'J2StoreModel')->getItem($order->order_state_id);
     $coupon_code = '';
     if ($ordercoupon) {
         $coupon_code = $ordercoupon[0]->coupon_code;
     }
     $orderinfo->billing_country_name = F0FModel::getTmpInstance('Countries', 'J2StoreModel')->getItem($orderinfo->billing_country_id)->country_name;
     $orderinfo->shipping_country_name = F0FModel::getTmpInstance('Countries', 'J2StoreModel')->getItem($orderinfo->shipping_country_id)->country_name;
     $orderinfo->billing_zone_name = F0FModel::getTmpInstance('Zones', 'J2StoreModel')->getItem($orderinfo->billing_zone_id)->zone_name;
     $orderinfo->shipping_zone_name = F0FModel::getTmpInstance('Zones', 'J2StoreModel')->getItem($orderinfo->shipping_zone_id)->zone_name;
     $tags = array("\\n" => "\n", '[SITENAME]' => $sitename, '[SITEURL]' => $baseURL, '[INVOICE_URL]' => $invoiceURL, '[ORDERID]' => $order->order_id, '[INVOICENO]' => $invoice_number, '[ORDERDATE]' => $order_date, '[ORDERSTATUS]' => JText::_($status->orderstatus_name), '[ORDERAMOUNT]' => $currency->format($order->get_formatted_grandtotal(), $order->currency_code, $order->currency_value), '[CUSTOMER_NAME]' => $orderinfo->billing_first_name . ' ' . $orderinfo->billing_last_name, '[BILLING_FIRSTNAME]' => $orderinfo->billing_first_name, '[BILLING_LASTNAME]' => $orderinfo->billing_last_name, '[BILLING_EMAIL]' => $order->user_email, '[BILLING_ADDRESS_1]' => $orderinfo->billing_address_1, '[BILLING_ADDRESS_2]' => $orderinfo->billing_address_2, '[BILLING_CITY]' => $orderinfo->billing_city, '[BILLING_ZIP]' => $orderinfo->billing_zip, '[BILLING_COUNTRY]' => $orderinfo->billing_country_name, '[BILLING_STATE]' => $orderinfo->billing_zone_name, '[BILLING_COMPANY]' => $orderinfo->billing_company, '[BILLING_VATID]' => $orderinfo->billing_tax_number, '[BILLING_PHONE]' => $orderinfo->billing_phone_1, '[BILLING_MOBILE]' => $orderinfo->billing_phone_2, '[SHIPPING_FIRSTNAME]' => $orderinfo->shipping_first_name, '[SHIPPING_LASTNAME]' => $orderinfo->shipping_last_name, '[SHIPPING_ADDRESS_1]' => $orderinfo->shipping_address_1, '[SHIPPING_ADDRESS_2]' => $orderinfo->shipping_address_2, '[SHIPPING_CITY]' => $orderinfo->shipping_city, '[SHIPPING_ZIP]' => $orderinfo->shipping_zip, '[SHIPPING_COUNTRY]' => $orderinfo->shipping_country_name, '[SHIPPING_STATE]' => $orderinfo->shipping_zone_name, '[SHIPPING_COMPANY]' => $orderinfo->shipping_company, '[SHIPPING_VATID]' => $orderinfo->shipping_tax_number, '[SHIPPING_PHONE]' => $orderinfo->shipping_phone_1, '[SHIPPING_MOBILE]' => $orderinfo->shipping_phone_2, '[SHIPPING_METHOD]' => JText::_($shipping->ordershipping_name), '[SHIPPING_TYPE]' => JText::_($shipping->ordershipping_name), '[SHIPPING_TRACKING_ID]' => $shipping->ordershipping_tracking_id, '[CUSTOMER_NOTE]' => $order->customer_note, '[PAYMENT_TYPE]' => JText::_($order->orderpayment_type), '[ORDER_TOKEN]' => $order->token, '[TOKEN]' => $order->token, '[COUPON_CODE]' => $coupon_code, '[ITEMS]' => $items);
     $tags = array_merge($tags, $extras);
     foreach ($tags as $key => $value) {
         $text = str_replace($key, $value, $text);
     }
     //process custom fields.
     //billing Format [CUSTOM_BILLING_FIELD:KEYNAME]
     $text = $this->processCustomFields($orderinfo, 'billing', $text);
     //shipping Format [CUSTOM_SHIPPING_FIELD:KEYNAME]
     $text = $this->processCustomFields($orderinfo, 'shipping', $text);
     //payment Format [CUSTOM_PAYMENT_FIELD:KEYNAME]
     $text = $this->processCustomFields($orderinfo, 'payment', $text);
     //now we have unprocessed fields. remove any other square brackets found.
     preg_match_all("^\\[(.*?)\\]^", $text, $removeFields, PREG_PATTERN_ORDER);
     if (count($removeFields[1])) {
         foreach ($removeFields[1] as $fieldName) {
             $text = str_replace('[' . $fieldName . ']', '', $text);
         }
     }
     J2Store::plugin()->event('AfterProcessTags', array($text, $order, $tags));
     return $text;
 }
        }
        ?>
							</th>
							<td><?php 
        echo $total['value'];
        ?>
</td>
						</tr>
					<?php 
    }
    ?>
				<?php 
}
?>
			</table>
			
			<div class="buttons-right">
				<span class="cart-checkout-button">
					<a class="btn btn-large btn-success" href="<?php 
echo $this->checkout_url;
?>
" ><?php 
echo JText::_('J2STORE_PROCEED_TO_CHECKOUT');
?>
 </a>
				</span>
				<?php 
echo J2Store::plugin()->eventWithHtml('AfterDisplayCheckoutButton', array($this->order));
?>
	
			</div>
Beispiel #20
0
 public function grant_download_permission()
 {
     if (empty($this->order_id)) {
         return;
     }
     F0FModel::getTmpInstance('Orderdownloads', 'J2StoreModel')->setDownloads($this, $override_status = true);
     J2Store::plugin()->event('GrantDownloadPermission', array($this));
     return true;
 }
Beispiel #21
0
					<form action="<?php 
        echo JRoute::_('index.php?option=com_j2store&view=checkout&task=confirmPayment');
        ?>
" method="post">
						<input type="submit" class="btn btn-primary" value="<?php 
        echo JText::_('J2STORE_PLACE_ORDER');
        ?>
" />

						<input type="hidden" name="option" value="com_j2store" />
						<input type="hidden" name="view" value="checkout" />
						<input type="hidden" name="task" value="confirmPayment" />
					</form>
				<?php 
    }
    ?>
			<?php 
} else {
    ?>
				<?php 
    echo $this->error;
    ?>
			<?php 
}
?>
			<?php 
echo J2Store::plugin()->eventWithHtml('AfterCheckoutConfirm', array($this));
?>
		</div>
	</div>
</div>
Beispiel #22
0
 function getContinueShoppingUrl()
 {
     $params = J2Store::config();
     $type = $params->get('config_continue_shopping_page', 'previous');
     $item = new JObject();
     $item->type = $type;
     switch ($type) {
         case 'previous':
         default:
             $item->url = '';
             break;
         case 'menu':
             $url = '';
             //get the menu item id
             $menu_itemid = $params->get('continue_shopping_page_menu', '');
             if (empty($menu_itemid)) {
                 $item->url = '';
                 $item->type = 'previous';
             } else {
                 $application = JFactory::getApplication();
                 $menu = $application->getMenu('site');
                 $menu_item = $menu->getItem($menu_itemid);
                 if (is_object($menu_item)) {
                     // we have the menu item. See if language associations are there
                     JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
                     try {
                         $associations = MenusHelper::getAssociations($menu_item->id);
                     } catch (Exception $e) {
                         $associations = array();
                     }
                     //get the current language code
                     $tag = JFactory::getLanguage()->getTag();
                     if (isset($associations[$tag])) {
                         $cmenu = $menu->getItem($associations[$tag]);
                     } else {
                         $cmenu = $menu_item;
                     }
                     $link = JRoute::_($cmenu->link . '&Itemid=' . $cmenu->id, false);
                     if (JURI::isInternal($link)) {
                         $url = $link;
                     }
                 }
                 if (empty($url)) {
                     $item->url = '';
                     $item->type = 'previous';
                 } else {
                     $item->url = $url;
                 }
             }
             break;
         case 'url':
             $custom_url = $params->get('config_continue_shopping_page_url', '');
             if (empty($custom_url)) {
                 $item->url = '';
                 $item->type = 'previous';
             } else {
                 $item->url = $custom_url;
             }
             break;
     }
     //allow plugins to alter the checkout link.
     //This allows 3rd-party developers to create different checkout steps for j2store
     //Example. The plugin can return a completely different link
     J2Store::plugin()->event('GetContinueShoppingUrl', array(&$item));
     return $item;
 }
                    ?>
" />
          <?php 
                }
                ?>
          <label for="option-value-<?php 
                echo $option_value['product_optionvalue_id'];
                ?>
">
          <?php 
                echo stripslashes($this->escape(JText::_($option_value['optionvalue_name'])));
                ?>
          </label>
          <br />
          <?php 
            }
            ?>
        </div>
        <br />
        <?php 
        }
        ?>
    		<?php 
        echo J2Store::plugin()->eventWithHtml('AfterDisplaySingleProductOption', array($this->product, $option));
        ?>
        <?php 
    }
    ?>
      </div>
      <?php 
}
Beispiel #24
0
 public function onAfterGetItem(&$model, &$record)
 {
     $app = JFactory::getApplication();
     J2Store::plugin()->importCatalogPlugins();
     $app->triggerEvent('onJ2StoreAfterGetProduct', array(&$record));
 }
Beispiel #25
0
" />
	<meta itemprop="priceCurrency" content="<?php 
    echo $this->currency->getCode();
    ?>
" />
	<link itemprop="availability" href="http://schema.org/<?php 
    echo $this->product->variant->availability ? 'InStock' : 'OutOfStock';
    ?>
" />
</div>
<?php 
}
?>

<?php 
echo J2Store::plugin()->eventWithHtml('AfterRenderingProductPrice', array($this->product));
?>

<?php 
if ($this->params->get('item_show_discount_percentage', 1) && isset($this->product->pricing->is_discount_pricing_available)) {
    ?>
	<?php 
    $discount = (1 - $this->product->pricing->price / $this->product->pricing->base_price) * 100;
    ?>
	<?php 
    if ($discount > 0) {
        ?>
		<div class="discount-percentage">
			<?php 
        echo round($discount) . ' % ' . JText::_('J2STORE_PRODUCT_OFFER');
        ?>
Beispiel #26
0
<?php

/**
 * @package J2Store
 * @copyright Copyright (c)2014-17 Ramesh Elamathi / J2Store.org
 * @license GNU GPL v3 or later
 */
// No direct access to this file
defined('_JEXEC') or die;
JHtml::_('behavior.modal');
$row = $this->item;
?>
	<?php 
$results = J2Store::plugin()->eventWithHtml('GetPromotionView', array($row));
?>
	<h3><?php 
echo JText::_($row->name);
?>
</h3>
	<?php 
echo $results;
Beispiel #27
0
<?php

/**
 * @package J2Store
* @copyright Copyright (c)2014-17 Ramesh Elamathi / J2Store.org
* @license GNU GPL v3 or later
*/
// No direct access to this file
defined('_JEXEC') or die;
JHTML::_('behavior.modal');
$this->params = J2Store::config();
$plugin_title_html = J2Store::plugin()->eventWithHtml('AddMyProfileTab');
$plugin_content_html = J2Store::plugin()->eventWithHtml('AddMyProfileTabContent', array($this->orders));
?>
<div class="j2store">
	<div class="j2store-order j2store-myprofile">
		<h3><?php 
echo JText::_('J2STORE_MYPROFILE');
?>
</h3>
		 <div class="tabbable tabs">
         	   <ul class="nav nav-tabs">
                  <li class="active">
	                  	<a href="#orders-tab" data-toggle="tab"><i class="fa fa-th-large"></i>
	                  		 <?php 
echo JText::_('J2STORE_MYPROFILE_ORDERS');
?>
	                  	</a>
                 </li>
                 	<?php 
if ($this->params->get('download_area', 1)) {
            echo JText::_('J2STORE_TERMS_AND_CONDITIONS');
            ?>
				<?php 
        }
        ?>
	<?php 
    }
    ?>
	</div>
<?php 
}
?>

<?php 
/****** To get App term  html ********/
echo J2Store::plugin()->eventWithHtml('AfterDisplayShippingPayment', array($this->order));
?>

<div class="buttons">
	<div class="left">
		<input type="button"
			value="<?php 
echo JText::_('J2STORE_CHECKOUT_CONTINUE');
?>
"
			id="button-payment-method" class="button btn btn-primary" />
	</div>
</div>
<input type="hidden" name="task"
	value="shipping_payment_method_validate" />
<input type="hidden" name="option" value="com_j2store" />
Beispiel #29
0
 /**
  * Gets an array of downloadable files for this product.
  *
  * @return array
  */
 public function get_files()
 {
     static $downloadable_files;
     if (!is_array($downloadable_files)) {
         $downloadable_files = array();
     }
     if (!isset($downloadable_files[$this->j2store_product_id])) {
         $downloadable_files[$this->j2store_product_id] = F0FModel::getTmpInstance('ProductFiles', 'J2StoreModel')->product_id($this->j2store_product_id)->getList();
         J2Store::plugin()->event('ProductFiles', array($downloadable_files[$this->j2store_product_id], $this));
     }
     return $downloadable_files[$this->j2store_product_id];
 }
        ?>
  <?php 
    }
    ?>
  <?php 
    echo $uhtml;
    ?>
  </div>
</div>
<?php 
}
?>

</div>
<?php 
echo J2Store::plugin()->eventWithHtml('CheckoutBilling', array($this));
?>
<br />
<div class="buttons">
  <div class="left">
    <input type="button" value="<?php 
echo JText::_('J2STORE_CHECKOUT_CONTINUE');
?>
" id="button-billing-address" class="button btn btn-primary" />
  </div>
</div>
	<input type="hidden" name="email" value="<?php 
echo JFactory::getUser()->email;
?>
" />
 <input type="hidden" name="task" value="billing_address_validate" />