本文整理匯總了PHP中J2Store::storeProfile方法的典型用法代碼示例。如果您正苦於以下問題:PHP J2Store::storeProfile方法的具體用法?PHP J2Store::storeProfile怎麽用?PHP J2Store::storeProfile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類J2Store
的用法示例。
在下文中一共展示了J2Store::storeProfile方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onAfterSave
protected function onAfterSave(&$table)
{
$store = J2Store::storeProfile();
if ($store->get('config_currency_auto', 1)) {
$this->updateCurrencies(false);
}
}
示例2: 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;
}
示例3: __construct
public function __construct($config = array())
{
$this->session = JFactory::getSession();
$this->input = JFactory::getApplication()->input;
if (count($this->currencies) < 1) {
$rows = F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->enabled(1)->getList();
foreach ($rows as $result) {
$this->currencies[$result->currency_code] = (array) $result;
}
}
$currency = $this->input->get('currency');
if (isset($currency) && array_key_exists($currency, $this->currencies)) {
$this->set($currency);
} elseif ($this->session->has('currency', 'j2store') && array_key_exists($this->session->get('currency', '', 'j2store'), $this->currencies)) {
$this->set($this->session->get('currency', '', 'j2store'));
} else {
$this->set(J2Store::storeProfile()->get('config_currency'));
}
}
示例4: display
function display($field, $value, $map, $inside, $options = '', $test = false, $allFields = null, $allValues = null)
{
$app = JFactory::getApplication();
$store = J2Store::storeProfile();
$stateId = $currentZoneId = $store->get('zone_id') > 0 ? $store->get('zone_id') : '';
$country_id = $store->get('country_id') > 0 ? $store->get('country_id') : '';
//if no default value was set in the fields, then use the country id set in the store profile.
if (empty($field->field_default)) {
$defaultCountry = $country_id;
}
if (empty($value)) {
$value = $field->field_default;
}
if ($field->field_options['zone_type'] == 'country') {
if (isset($defaultCountry)) {
$field->field_default = $defaultCountry;
}
if (empty($value)) {
$value = $field->field_default;
}
} elseif ($field->field_options['zone_type'] == 'zone') {
$stateId = str_replace(array('[', ']'), array('_', ''), $map);
$dropdown = '';
if ($allFields != null) {
$country = null;
foreach ($allFields as $f) {
if ($f->field_type == 'zone' && !empty($f->field_options['zone_type']) && $f->field_options['zone_type'] == 'country') {
$key = $f->field_namekey;
if (!empty($allValues->{$key})) {
$country = $allValues->{$key};
} else {
$country = $f->field_default;
}
break;
}
}
//no country id, then load it based on the zone default.
if (empty($country) && isset($field->field_default)) {
F0FTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/tables');
$table = F0FTable::getAnInstance('Zone', 'J2StoreTable');
if ($table->load($field->field_default)) {
$country = $table->country_id;
}
}
//still no. Set it to store default.
if (empty($country)) {
$country = $store->get('country_id');
if (empty($value)) {
$value = $store->get('zone_id');
}
}
if (!empty($country)) {
$countryType = new j2storeCountryType();
$countryType->type = 'zone';
$countryType->country_id = $country;
$countryType->published = true;
$dropdown = $countryType->displayZone($map, $value, true);
}
}
$html = '<span id="' . $stateId . '_container">' . $dropdown . '</span>' . '<input type="hidden" id="' . $stateId . '_default_value" name="' . $stateId . '_default_value" value="' . $value . '"/>';
return $html;
}
return parent::display($field, $value, $map, $inside, $options, $test, $allFields, $allValues);
}
示例5: _updateCurrency
function _updateCurrency()
{
$session = JFactory::getSession();
//if auto update currency is set, then call the update function
$store_config = J2Store::storeProfile();
//session based check. We dont want to update currency when we load each and every item.
if ($store_config->get('config_currency_auto') && !$session->has('currency_updated', 'j2store')) {
F0FModel::getTmpInstance('Currencies', 'J2StoreModel')->updateCurrencies();
$session->set('currency_updated', '1', 'j2store');
}
}
示例6: generateInvoiceNumber
public function generateInvoiceNumber()
{
if (empty($this->order_id)) {
return;
}
$db = JFactory::getDbo();
$status = true;
$store = J2Store::storeProfile();
$store_invoice_prefix = $store->get('invoice_prefix');
if (!isset($store_invoice_prefix) || empty($store_invoice_prefix)) {
//backward compatibility. If no prefix is set, retain the invoice number is the table primary key.
$status = false;
}
if ($status) {
//get the last row
$query = $db->getQuery(true)->select('MAX(invoice_number) AS invoice_number')->from('#__j2store_orders')->where('invoice_prefix=' . $db->q($store->get('invoice_prefix')));
$db->setQuery($query);
$row = $db->loadObject();
if (isset($row->invoice_number) && $row->invoice_number) {
$invoice_number = $row->invoice_number + 1;
} else {
$invoice_number = 1;
}
$this->invoice_number = $invoice_number;
$this->invoice_prefix = $store->get('invoice_prefix');
}
}
示例7: shipping_payment_method
function shipping_payment_method()
{
$app = JFactory::getApplication();
$session = JFactory::getSession();
$user = JFactory::getUser();
$params = J2Store::config();
$address_model = F0FModel::getTmpInstance('Addresses', 'J2StoreModel');
$view = $this->getThisView();
if ($model = $this->getThisModel()) {
// Push the model into the view (as default)
$view->setModel($model, true);
}
$order = F0FModel::getTmpInstance('Orders', 'J2StoreModel')->initOrder()->getOrder();
if ($order->getItemCount() < 1) {
$msg = JText::_('J2STORE_NO_ITEMS_IN_CART');
$link = JRoute::_('index.php?option=com_j2store&view=carts');
$app->redirect($link, $msg);
}
JPluginHelper::importPlugin('j2store');
//custom fields
$selectableBase = J2Store::getSelectableBase();
$view->assign('fieldsClass', $selectableBase);
$address_table = F0FTable::getAnInstance('Address', 'J2StoreTable');
$fields = $selectableBase->getFields('payment', $address, 'address');
$view->assign('fields', $fields);
$view->assign('address', $address_table);
//get layout settings
$view->assign('storeProfile', J2Store::storeProfile());
//shipping
$showShipping = false;
if ($params->get('show_shipping_address', 0)) {
$showShipping = true;
}
if ($isShippingEnabled = $order->isShippingEnabled()) {
$showShipping = true;
}
$view->assign('showShipping', $showShipping);
if ($showShipping) {
$shipping_layout = "shipping_yes";
$shipping_method_form = $this->getShippingHtml($shipping_layout, $order);
$view->assign('showShipping', $showShipping);
$view->assign('shipping_method_form', $shipping_method_form);
//$view->assign( 'rates', $rates );
}
//process payment plugins
$showPayment = true;
if ((double) $order->order_total == (double) '0.00') {
$showPayment = false;
}
$view->assign('showPayment', $showPayment);
$payment_plugins = J2Store::plugin()->getPluginsWithEvent('onJ2StoreGetPaymentPlugins');
$default_method = $params->get('default_payment_method', '');
$plugins = array();
if ($payment_plugins) {
foreach ($payment_plugins as $plugin) {
$results = $app->triggerEvent("onJ2StoreGetPaymentOptions", array($plugin->element, $order));
if (!in_array(false, $results, false)) {
if (!empty($default_method) && $default_method == $plugin->element) {
$plugin->checked = true;
$html = $this->getPaymentForm($plugin->element, true);
$view->assign('payment_form_div', $html);
}
$plugins[] = $plugin;
}
}
}
if (count($plugins) == 1) {
$plugins[0]->checked = true;
$html = $this->getPaymentForm($plugins[0]->element, true);
$view->assign('payment_form_div', $html);
}
$view->assign('plugins', $plugins);
$view->assign('order', $order);
$view->assign('params', $params);
$view->setLayout('default_shipping_payment');
$html = '';
ob_start();
$view->display();
$html .= ob_get_contents();
ob_end_clean();
echo $html;
$app->close();
}
示例8: getQuantityRestriction
public function getQuantityRestriction(&$variant)
{
$store = J2Store::storeProfile();
if (isset($variant->use_store_config_min_sale_qty) && $variant->use_store_config_min_sale_qty > 0) {
$variant->min_sale_qty = (double) $store->get('store_min_sale_qty');
}
if (isset($variant->use_store_config_max_sale_qty) && $variant->use_store_config_max_sale_qty > 0) {
$variant->max_sale_qty = (double) $store->get('store_max_sale_qty');
}
if (isset($variant->use_store_config_notify_qty) && $variant->use_store_config_notify_qty > 0) {
$variant->notify_qty = (double) $store->get('store_notify_qty');
}
}