本文整理汇总了PHP中Isotope\Isotope类的典型用法代码示例。如果您正苦于以下问题:PHP Isotope类的具体用法?PHP Isotope怎么用?PHP Isotope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Isotope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAvailable
/**
* Check the cart currency for ePay support
*
* @return bool
*/
public function isAvailable()
{
if (!static::supportsCurrency(Isotope::getConfig()->currency)) {
return false;
}
return parent::isAvailable();
}
示例2: isAvailable
/**
* Check the cart currency for ePay support
*
* @return bool
*/
public function isAvailable()
{
if (!Currency::isSupported(Isotope::getConfig()->currency)) {
return false;
}
return parent::isAvailable();
}
示例3: compile
/**
* Generate the module
*/
protected function compile()
{
$objCart = Isotope::getCart();
$objAddress = $objCart->getShippingAddress();
$this->Template->showResults = false;
$this->Template->requiresShipping = false;
// There is no address
if (!$objAddress->id) {
return;
}
$this->Template->showResults = true;
$arrMethods = array();
// Get the shipping methods
if ($objAddress->id && $objCart->requiresShipping()) {
$this->Template->requiresShipping = true;
$objShippingMethods = Shipping::findMultipleByIds($this->arrShippingMethods);
/* @var Shipping $objShipping */
foreach ($objShippingMethods as $objShipping) {
if ($objShipping->isAvailable()) {
$fltPrice = $objShipping->getPrice();
$arrMethods[] = array('label' => $objShipping->getLabel(), 'price' => $fltPrice, 'formatted_price' => Isotope::formatPriceWithCurrency($fltPrice), 'shipping' => $objShipping);
}
}
RowClass::withKey('rowClass')->addCount('row_')->addFirstLast('row_')->addEvenOdd('row_')->applyTo($arrMethods);
}
$this->Template->shippingMethods = $arrMethods;
}
示例4: generate
/**
* Generate the checkout step
*
* @return string
*/
public function generate()
{
$objTemplate = new Template($this->objModule->iso_collectionTpl);
$objOrder = Isotope::getCart()->getDraftOrder();
$objOrder->addToTemplate($objTemplate, array('gallery' => $this->objModule->iso_gallery, 'sorting' => $objOrder->getItemsSortingCallable($this->objModule->iso_orderCollectionBy)));
return $objTemplate->parse();
}
示例5: findProducts
/**
* Fill the object's arrProducts array
*
* @param array|null $arrCacheIds
*
* @return array
*/
protected function findProducts($arrCacheIds = null)
{
$t = Product::getTable();
$arrColumns = array();
$arrCategories = $this->findCategories();
$arrProductIds = \Database::getInstance()->query("\n SELECT pid\n FROM tl_iso_product_category\n WHERE page_id IN (" . implode(',', $arrCategories) . ")\n ")->fetchEach('pid');
$arrTypes = \Database::getInstance()->query("SELECT id FROM tl_iso_producttype WHERE variants='1'")->fetchEach('id');
if (empty($arrProductIds)) {
return array();
}
$queryBuilder = new FilterQueryBuilder(Isotope::getRequestCache()->getFiltersForModules($this->iso_filterModules));
$arrColumns[] = "(\n ({$t}.id IN (" . implode(',', $arrProductIds) . ") AND {$t}.type NOT IN (" . implode(',', $arrTypes) . "))\n OR {$t}.pid IN (" . implode(',', $arrProductIds) . ")\n )";
if (!empty($arrCacheIds) && is_array($arrCacheIds)) {
$arrColumns[] = Product::getTable() . ".id IN (" . implode(',', $arrCacheIds) . ")";
}
// Apply new/old product filter
if ($this->iso_newFilter == 'show_new') {
$arrColumns[] = Product::getTable() . ".dateAdded>=" . Isotope::getConfig()->getNewProductLimit();
} elseif ($this->iso_newFilter == 'show_old') {
$arrColumns[] = Product::getTable() . ".dateAdded<" . Isotope::getConfig()->getNewProductLimit();
}
if ($this->iso_list_where != '') {
$arrColumns[] = $this->iso_list_where;
}
if ($queryBuilder->hasSqlCondition()) {
$arrColumns[] = $queryBuilder->getSqlWhere();
}
$arrSorting = Isotope::getRequestCache()->getSortingsForModules($this->iso_filterModules);
if (empty($arrSorting) && $this->iso_listingSortField != '') {
$direction = $this->iso_listingSortDirection == 'DESC' ? Sort::descending() : Sort::ascending();
$arrSorting[$this->iso_listingSortField] = $direction;
}
$objProducts = Product::findAvailableBy($arrColumns, $queryBuilder->getSqlValues(), array('order' => 'c.sorting', 'filters' => $queryBuilder->getFilters(), 'sorting' => $arrSorting));
return null === $objProducts ? array() : $objProducts->getModels();
}
示例6: generate
/**
* Generate the checkout step
* @return string
*/
public function generate()
{
// Make sure field data is available
\Controller::loadDataContainer('tl_iso_product_collection');
\System::loadLanguageFile('tl_iso_product_collection');
$objTemplate = new Template($this->strTemplate);
$varValue = null;
$objWidget = new FormTextArea(FormTextArea::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField], $this->strField, $varValue, $this->strField, $this->strTable, $this));
$objWidget->storeValues = true;
if (\Input::post('FORM_SUBMIT') == $this->strFormId) {
$objWidget->validate();
$varValue = $objWidget->value;
// Do not submit the field if there are errors
if ($objWidget->hasErrors()) {
$doNotSubmit = true;
} elseif ($objWidget->submitInput()) {
$objOrder = Isotope::getCart()->getDraftOrder();
// Store the form data
$_SESSION['FORM_DATA'][$this->strField] = $varValue;
// Set the correct empty value (see #6284, #6373)
if ($varValue === '') {
$varValue = $objWidget->getEmptyValue();
}
// Set the new value
if ($varValue !== $objOrder->{$this->strField}) {
$objOrder->{$this->strField};
}
}
}
$objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable][$this->strField][0];
$objTemplate->customerNotes = $objWidget->parse();
return $objTemplate->parse();
}
示例7: isAvailable
/**
* sofortueberweisung.de only supports these currencies
* @return true
*/
public function isAvailable()
{
if (!in_array(Isotope::getConfig()->currency, array('EUR', 'CHF', 'GBP'))) {
return false;
}
return parent::isAvailable();
}
示例8: compile
/**
* Generate the module
*/
protected function compile()
{
// Also check owner (see #126)
if (($objOrder = Order::findOneBy('uniqid', (string) \Input::get('uid'))) === null || FE_USER_LOGGED_IN === true && $objOrder->member > 0 && \FrontendUser::getInstance()->id != $objOrder->member) {
$this->Template = new \Isotope\Template('mod_message');
$this->Template->type = 'error';
$this->Template->message = $GLOBALS['TL_LANG']['ERR']['orderNotFound'];
return;
}
// Order belongs to a member but not logged in
if (TL_MODE == 'FE' && $this->iso_loginRequired && $objOrder->member > 0 && FE_USER_LOGGED_IN !== true) {
global $objPage;
$objHandler = new $GLOBALS['TL_PTY']['error_403']();
$objHandler->generate($objPage->id);
exit;
}
Isotope::setConfig($objOrder->getRelated('config_id'));
$objTemplate = new \Isotope\Template($this->iso_collectionTpl);
$objTemplate->linkProducts = true;
$objOrder->addToTemplate($objTemplate, array('gallery' => $this->iso_gallery, 'sorting' => $objOrder->getItemsSortingCallable($this->iso_orderCollectionBy)));
$this->Template->collection = $objOrder;
$this->Template->products = $objTemplate->parse();
$this->Template->info = deserialize($objOrder->checkout_info, true);
$this->Template->date = Format::date($objOrder->locked);
$this->Template->time = Format::time($objOrder->locked);
$this->Template->datim = Format::datim($objOrder->locked);
$this->Template->orderDetailsHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['orderDetailsHeadline'], $objOrder->document_number, $this->Template->datim);
$this->Template->orderStatus = sprintf($GLOBALS['TL_LANG']['MSC']['orderStatusHeadline'], $objOrder->getStatusLabel());
$this->Template->orderStatusKey = $objOrder->getStatusAlias();
}
示例9: isAvailable
/**
* Paybyway only supports EUR currency
* @return bool
*/
public function isAvailable()
{
$objConfig = Isotope::getConfig();
if (null === $objConfig || $objConfig->currency != 'EUR') {
return false;
}
return parent::isAvailable();
}
示例10: addOrderCondition
/**
* Automatically add Billpay conditions to checkout form
*
* @param Form $objForm
* @param \Module $objModule
*/
public static function addOrderCondition(Form $objForm, \Module $objModule)
{
if (Isotope::getCart()->hasPayment() && Isotope::getCart()->getPaymentMethod() instanceof BillpayWithSaferpay) {
$strLabel = $GLOBALS['TL_LANG']['MSC']['billpay_agb_' . Isotope::getCart()->getBillingAddress()->country];
if ($strLabel == '') {
throw new \LogicException('Missing BillPay AGB for country "' . Isotope::getCart()->getBillingAddress()->country . '" and language "' . $GLOBALS['TL_LANGUAGE'] . '"');
}
$objForm->addFormField('billpay_confirmation', array('label' => array('', $strLabel), 'inputType' => 'checkbox', 'eval' => array('mandatory' => true)));
}
}
示例11: generate
public function generate(IsotopeProduct $objProduct, array $arrOptions = array())
{
$arrData = deserialize($objProduct->{$this->field_name});
if (is_array($arrData) && $arrData['unit'] > 0 && $arrData['value'] != '') {
$objBasePrice = \Isotope\Model\BasePrice::findByPk((int) $arrData['unit']);
if (null !== $objBasePrice && null !== $objProduct->getPrice()) {
return sprintf($objBasePrice->getLabel(), Isotope::formatPriceWithCurrency($objProduct->getPrice()->getAmount() / $arrData['value'] * $objBasePrice->amount), $arrData['value']);
}
}
return '';
}
示例12: compile
/**
* Compile the module
* @return void
*/
protected function compile()
{
$arrConfigs = array();
$objConfigs = Config::findMultipleByIds($this->iso_config_ids);
if (null !== $objConfigs) {
while ($objConfigs->next()) {
$arrConfigs[] = array('config' => $objConfigs->current(), 'label' => $objConfigs->current()->getLabel(), 'active' => Isotope::getConfig()->id == $objConfigs->id ? true : false, 'href' => \Environment::get('request') . (strpos(\Environment::get('request'), '?') === false ? '?' : '&') . 'config=' . $objConfigs->id);
}
}
\Haste\Generator\RowClass::withKey('class')->addFirstLast()->applyTo($arrConfigs);
$this->Template->configs = $arrConfigs;
}
示例13: trackGATransaction
/**
* Actually execute the GoogleAnalytics tracking
* @param Database_Result
* @param IsotopeProductCollection
*/
protected function trackGATransaction($objConfig, $objOrder)
{
// Initilize GA Tracker
$tracker = new \UnitedPrototype\GoogleAnalytics\Tracker($objConfig->ga_account, \Environment::get('base'));
// Assemble Visitor information
// (could also get unserialized from database)
$visitor = new \UnitedPrototype\GoogleAnalytics\Visitor();
$visitor->setIpAddress(\Environment::get('ip'));
$visitor->setUserAgent(\Environment::get('httpUserAgent'));
$transaction = new \UnitedPrototype\GoogleAnalytics\Transaction();
$transaction->setOrderId($objOrder->order_id);
$transaction->setAffiliation($objConfig->name);
$transaction->setTotal($objOrder->getTotal());
$transaction->setTax($objOrder->getTotal() - $objOrder->getTaxFreeTotal());
// $transaction->setShipping($objOrder->shippingTotal);
$objAddress = $objOrder->getBillingAddress();
$transaction->setCity($objAddress->city);
if ($objAddress->subdivision) {
$arrSub = explode("-", $objAddress->subdivision, 2);
$transaction->setRegion($arrSub[1]);
}
$transaction->setCountry($objAddress->country);
/** @var \Isotope\Model\ProductCollectionItem $objItem */
foreach ($objOrder->getItems() as $objItem) {
$item = new \UnitedPrototype\GoogleAnalytics\Item();
if ($objItem->getSku()) {
$item->setSku($objItem->getSku());
} else {
$item->setSku('product' . $objItem->product_id);
}
$item->setName($objItem->getName());
$item->setPrice($objItem->getPrice());
$item->setQuantity($objItem->quantity);
$arrOptionValues = array();
foreach (Isotope::formatOptions($objItem->getOptions()) as $option) {
$arrOptionValues[] = $option['value'];
}
if (!empty($arrOptionValues)) {
$item->setVariation(implode(', ', $arrOptionValues));
}
$transaction->addItem($item);
}
// Track logged-in member as custom variable
if ($objConfig->ga_member != '' && $objOrder->member > 0 && ($objMember = \MemberModel::findByPk($objOrder->member)) !== null) {
$customVar = new \UnitedPrototype\GoogleAnalytics\CustomVariable(1, 'Member', $this->parseSimpleTokens($objConfig->ga_member, $objMember->row()), \UnitedPrototype\GoogleAnalytics\CustomVariable::SCOPE_VISITOR);
$tracker->addCustomVariable($customVar);
}
// Assemble Session information
// (could also get unserialized from PHP session)
$session = new \UnitedPrototype\GoogleAnalytics\Session();
$tracker->trackTransaction($transaction, $session, $visitor);
}
示例14: limitCountries
/**
* Limit the member countries to the selection in store config
* @param string
*/
public function limitCountries($strTable)
{
if ($strTable != 'tl_member' || !Isotope::getConfig()->limitMemberCountries) {
return;
}
$arrCountries = array_unique(array_merge(Isotope::getConfig()->getBillingCountries(), Isotope::getConfig()->getShippingCountries()));
$arrCountries = array_intersect_key($GLOBALS['TL_DCA']['tl_member']['fields']['country']['options'], array_flip($arrCountries));
$GLOBALS['TL_DCA']['tl_member']['fields']['country']['options'] = $arrCountries;
if (count($arrCountries) == 1) {
$arrCountryCodes = array_keys($arrCountries);
$GLOBALS['TL_DCA']['tl_member']['fields']['country']['default'] = $arrCountryCodes[0];
}
}
示例15: isAvailable
/**
* SEPA only supports these currencies
* @return true
*/
public function isAvailable()
{
if (!in_array(Isotope::getConfig()->currency, array('EUR'))) {
return false;
}
if (!FE_USER_LOGGED_IN) {
return false;
} else {
$user = \FrontendUser::getInstance();
if (!isset($user->iso_sepa_active) || $user->iso_sepa_active != "1") {
return false;
}
}
return parent::isAvailable();
}