本文整理汇总了PHP中Thelia\Core\Template\Element\LoopResultRow::set方法的典型用法代码示例。如果您正苦于以下问题:PHP LoopResultRow::set方法的具体用法?PHP LoopResultRow::set怎么用?PHP LoopResultRow::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thelia\Core\Template\Element\LoopResultRow
的用法示例。
在下文中一共展示了LoopResultRow::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseResults
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $item) {
// var_dump($item); die();
$loopResultRow = new LoopResultRow();
if ((bool) $this->getDisplayLink() == true) {
$tweet = $item->text;
// Screen name link
$pattern = '@(https?://([-\\w\\.]+)+(/([\\w/_\\.]*(\\?\\S+)?(#\\S+)?)?)?)@';
$replacement = '<a href="$1">$1</a>';
$tweet = preg_replace($pattern, $replacement, $tweet);
// HTTP(S) link
$pattern = '/@(\\w+)/i';
$replacement = '<a href="https://www.twitter.com/$1">@$1</a>';
$tweet = preg_replace($pattern, $replacement, $tweet);
// Hashtag link
$pattern = '/\\s+#(\\w+)/';
$replacement = ' <a href="http://search.twitter.com/search?q=%23$1">#$1</a>';
$tweet = preg_replace($pattern, $replacement, $tweet);
$loopResultRow->set("TEXT", preg_replace($pattern, $replacement, $tweet));
} else {
$loopResultRow->set("TEXT", $item->text);
}
$datetime = new \DateTime($item->created_at);
$datetime->setTimezone(new \DateTimeZone('Europe/Zurich'));
// echo $datetime->format('U');
// echo $item->created_at;
// die(strtotime($item->created_at));
$loopResultRow->set("CREATED_AT", $datetime->format('U'));
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例2: parseResults
public function parseResults(LoopResult $loopResult)
{
$taxCountry = $this->container->get('thelia.taxEngine')->getDeliveryCountry();
$locale = $this->request->getSession()->getLang()->getLocale();
$checkAvailability = ConfigQuery::checkAvailableStock();
$defaultAvailability = intval(ConfigQuery::read('default-available-stock', 100));
/** @var CartItemModel $cartItem */
foreach ($loopResult->getResultDataCollection() as $cartItem) {
$product = $cartItem->getProduct(null, $locale);
$productSaleElement = $cartItem->getProductSaleElements();
$loopResultRow = new LoopResultRow();
$loopResultRow->set("ITEM_ID", $cartItem->getId());
$loopResultRow->set("TITLE", $product->getTitle());
$loopResultRow->set("REF", $product->getRef());
$loopResultRow->set("QUANTITY", $cartItem->getQuantity());
$loopResultRow->set("PRODUCT_ID", $product->getId());
$loopResultRow->set("PRODUCT_URL", $product->getUrl($this->request->getSession()->getLang()->getLocale()));
if (!$checkAvailability || $product->getVirtual() === 1) {
$loopResultRow->set("STOCK", $defaultAvailability);
} else {
$loopResultRow->set("STOCK", $productSaleElement->getQuantity());
}
$loopResultRow->set("PRICE", $cartItem->getPrice())->set("PROMO_PRICE", $cartItem->getPromoPrice())->set("TAXED_PRICE", $cartItem->getTaxedPrice($taxCountry))->set("PROMO_TAXED_PRICE", $cartItem->getTaxedPromoPrice($taxCountry))->set("IS_PROMO", $cartItem->getPromo() === 1 ? 1 : 0);
$loopResultRow->set("TOTAL_PRICE", $cartItem->getPrice() * $cartItem->getQuantity())->set("TOTAL_PROMO_PRICE", $cartItem->getPromoPrice() * $cartItem->getQuantity())->set("TOTAL_TAXED_PRICE", $cartItem->getTotalTaxedPrice($taxCountry))->set("TOTAL_PROMO_TAXED_PRICE", $cartItem->getTotalTaxedPromoPrice($taxCountry));
$loopResultRow->set("PRODUCT_SALE_ELEMENTS_ID", $productSaleElement->getId());
$loopResultRow->set("PRODUCT_SALE_ELEMENTS_REF", $productSaleElement->getRef());
$this->addOutputFields($loopResultRow, $cartItem);
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例3: parseResults
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var CustomerBirthDate $customerBirthDate */
foreach ($loopResult->getResultDataCollection() as $customerBirthDate) {
$loopResultRow = new LoopResultRow($customerBirthDate);
$loopResultRow->set("CUSTOMER_ID", $customerBirthDate->getId());
$loopResultRow->set("BIRTHDATE", $customerBirthDate->getBirthDate('Y-m-d'));
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例4: parseResults
public function parseResults(LoopResult $loopResult)
{
/** @var Category $data */
foreach ($loopResult->getResultDataCollection() as $data) {
$loopResultRow = new LoopResultRow();
$loopResultRow->set("THELIA_CATEGORY_ID", $data->getId());
$loopResultRow->set("THELIA_CATEGORY_TITLE", $data->getVirtualColumn('i18n_TITLE'));
$loopResultRow->set("GOOGLE_CATEGORY", $data->getVirtualColumn('google_category'));
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例5: parseResults
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var OrderAddressSocolissimo $orderAddressSocolissimo */
foreach ($loopResult->getResultDataCollection() as $orderAddressSocolissimo) {
$row = new LoopResultRow();
$row->set('ID', $orderAddressSocolissimo->getId());
$row->set('CODE', $orderAddressSocolissimo->getCode());
$row->set('TYPE', $orderAddressSocolissimo->getType());
$loopResult->addRow($row);
}
return $loopResult;
}
示例6: parseResults
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/** @var GoogleshoppingAccount $account */
foreach ($loopResult->getResultDataCollection() as $account) {
$loopResultRow = new LoopResultRow();
$loopResultRow->set("ID", $account->getId());
$loopResultRow->set("MERCHANT_ID", $account->getMerchantId());
$loopResultRow->set("DEFAULT_COUNTRY_ID", $account->getDefaultCountryId());
$loopResultRow->set("DEFAULT_CURRENCY_ID", $account->getDefaultCurrencyId());
$loopResultRow->set("IS_DEFAULT", $account->getIsDefault());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例7: parseResults
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $resource) {
$loopResultRow = new LoopResultRow($resource);
$loopResultRow->set("ID", $resource->getId())->set("IS_TRANSLATED", $resource->getVirtualColumn('IS_TRANSLATED'))->set("LOCALE", $this->locale)->set("CODE", $resource->getCode())->set("TITLE", $resource->getVirtualColumn('i18n_TITLE'))->set("CHAPO", $resource->getVirtualColumn('i18n_CHAPO'))->set("DESCRIPTION", $resource->getVirtualColumn('i18n_DESCRIPTION'))->set("POSTSCRIPTUM", $resource->getVirtualColumn('i18n_POSTSCRIPTUM'));
if (null !== $this->getProfile()) {
$accessValue = $resource->getVirtualColumn('access');
$manager = new AccessManager($accessValue);
$loopResultRow->set("VIEWABLE", $manager->can(AccessManager::VIEW) ? 1 : 0)->set("CREATABLE", $manager->can(AccessManager::CREATE) ? 1 : 0)->set("UPDATABLE", $manager->can(AccessManager::UPDATE) ? 1 : 0)->set("DELETABLE", $manager->can(AccessManager::DELETE) ? 1 : 0);
}
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例8: parseResults
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
/*
* Check if loop is used with TransferPayment module
*/
/** @var $row \TransferPayment\Model\TransferPaymentConfig */
foreach ($loopResult->getResultDataCollection() as $row) {
$loopResultRow = new LoopResultRow();
$loopResultRow->set("KEY", $row->getName());
$loopResultRow->set("VALUE", $row->getValue());
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例9: parseResults
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $location) {
$loopResultRow = new LoopResultRow($location);
$loopResultRow->set("ID", $location->getID())->set("COMPANY", $location->getCompany())->set("FIRSTNAME", $location->getFirstname())->set("LASTNAME", $location->getLastname())->set("LAT", $location->getLat())->set("LNG", $location->getLng())->set("ADRESSE1", $location->getAddress1())->set("ADRESSE2", $location->getAddress2())->set("ADRESSE3", $location->getAddress3())->set("ZIPCODE", $location->getZipcode())->set("CITY", $location->getCity())->set("COUNTRY", $location->getCountryId())->set("VISIBLE", $location->getVisible() ? "1" : "0");
if ($this->getBackend_context() || $this->getWithPrevNextInfo()) {
// Find previous and next sale location
$previous = SalesLocationsQuery::create()->filterById($location->getId(), Criteria::LESS_THAN)->orderById(Criteria::DESC)->findOne();
$next = SalesLocationsQuery::create()->filterById($location->getId(), Criteria::GREATER_THAN)->orderById(Criteria::ASC)->findOne();
$loopResultRow->set("HAS_PREVIOUS", $previous != null ? 1 : 0)->set("HAS_NEXT", $next != null ? 1 : 0)->set("PREVIOUS", $previous != null ? $previous->getId() : -1)->set("NEXT", $next != null ? $next->getId() : -1);
}
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例10: parseComplexResults
public function parseComplexResults(LoopResult $loopResult)
{
$taxCalculator = new Calculator();
$taxCountry = $this->container->get('thelia.taxEngine')->getDeliveryCountry();
/** @var \Thelia\Core\Security\SecurityContext $securityContext */
$securityContext = $this->container->get('thelia.securityContext');
/** @var \Thelia\Model\Product $product */
foreach ($loopResult->getResultDataCollection() as $product) {
$loopResultRow = new LoopResultRow($product);
$price = $product->getRealLowestPrice();
if ($securityContext->hasCustomerUser() && $securityContext->getCustomerUser()->getDiscount() > 0) {
$price = $price * (1 - $securityContext->getCustomerUser()->getDiscount() / 100);
}
try {
$taxedPrice = round($taxCalculator->load($product, $taxCountry)->getTaxedPrice($price), 2);
} catch (TaxEngineException $e) {
$taxedPrice = null;
}
// Find previous and next product, in the default category.
$default_category_id = $product->getVirtualColumn('DefaultCategoryId');
$loopResultRow->set("BEST_PRICE", $price)->set("BEST_PRICE_TAX", $taxedPrice - $price)->set("BEST_TAXED_PRICE", $taxedPrice)->set("IS_PROMO", $product->getVirtualColumn('main_product_is_promo'))->set("IS_NEW", $product->getVirtualColumn('main_product_is_new'));
$loopResult->addRow($this->associateValues($loopResultRow, $product, $default_category_id));
}
return $loopResult;
}
示例11: parseResults
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
foreach ($loopResult->getResultDataCollection() as $menuItem) {
$loopResultRow = new LoopResultRow($menuItem);
// $title=$menuItem->getVirtualColumn('i18n_TITLE');
$type = 'category';
switch ($menuItem->getTypobj()) {
case 0:
/* $category = CategoryI18nQuery::create()->findOneById($menuItem->getObjet());
$category->setLocale('fr_FR');
if(!$title)$title=$category->getTitle();*/
$type = 'category';
break;
case 1:
$type = 'product';
break;
case 2:
$type = 'folder';
break;
case 3:
$type = 'content';
break;
}
$loopResultRow->set('ID', $menuItem->getId())->set('OBJET', $menuItem->getObjet())->set('TYPE', $type);
$loopResult->addRow($loopResultRow);
}
return $loopResult;
}
示例12: parseResults
public function parseResults(LoopResult $loopResult)
{
$this->container->get('thelia.condition.factory');
if (null !== ($order = OrderQuery::create()->findPk($this->getOrder()))) {
$oneDayInSeconds = 86400;
/** @var \Thelia\Model\OrderCoupon $orderCoupon */
foreach ($loopResult->getResultDataCollection() as $orderCoupon) {
$loopResultRow = new LoopResultRow($orderCoupon);
$now = time();
$datediff = $orderCoupon->getExpirationDate()->getTimestamp() - $now;
$daysLeftBeforeExpiration = floor($datediff / $oneDayInSeconds);
$freeShippingForCountriesIds = [];
/** @var OrderCouponCountry $couponCountry */
foreach ($orderCoupon->getFreeShippingForCountries() as $couponCountry) {
$freeShippingForCountriesIds[] = $couponCountry->getCountryId();
}
$freeShippingForModulesIds = [];
/** @var OrderCouponModule $couponModule */
foreach ($orderCoupon->getFreeShippingForModules() as $couponModule) {
$freeShippingForModulesIds[] = $couponModule->getModuleId();
}
$loopResultRow->set("ID", $orderCoupon->getId())->set("CODE", $orderCoupon->getCode())->set("DISCOUNT_AMOUNT", $orderCoupon->getAmount())->set("TITLE", $orderCoupon->getTitle())->set("SHORT_DESCRIPTION", $orderCoupon->getShortDescription())->set("DESCRIPTION", $orderCoupon->getDescription())->set("EXPIRATION_DATE", $orderCoupon->getExpirationDate($order->getLangId()))->set("IS_CUMULATIVE", $orderCoupon->getIsCumulative())->set("IS_REMOVING_POSTAGE", $orderCoupon->getIsRemovingPostage())->set("IS_AVAILABLE_ON_SPECIAL_OFFERS", $orderCoupon->getIsAvailableOnSpecialOffers())->set("DAY_LEFT_BEFORE_EXPIRATION", $daysLeftBeforeExpiration)->set("FREE_SHIPPING_FOR_COUNTRIES_LIST", implode(',', $freeShippingForCountriesIds))->set("FREE_SHIPPING_FOR_MODULES_LIST", implode(',', $freeShippingForModulesIds))->set("PER_CUSTOMER_USAGE_COUNT", $orderCoupon->getPerCustomerUsageCount())->set("IS_USAGE_CANCELED", $orderCoupon->getUsageCanceled());
$this->addOutputFields($loopResultRow, $orderCoupon);
$loopResult->addRow($loopResultRow);
}
}
return $loopResult;
}
示例13: parseResults
public function parseResults(LoopResult $loopResult)
{
$country = $this->getCurrentCountry();
$state = $this->getCurrentState();
$cart = $this->request->getSession()->getSessionCart($this->dispatcher);
$virtual = $cart->isVirtual();
/** @var Module $deliveryModule */
foreach ($loopResult->getResultDataCollection() as $deliveryModule) {
$areaDeliveryModule = AreaDeliveryModuleQuery::create()->findByCountryAndModule($country, $deliveryModule, $state);
if (null === $areaDeliveryModule && false === $virtual) {
continue;
}
/** @var DeliveryModuleInterface $moduleInstance */
$moduleInstance = $deliveryModule->getDeliveryModuleInstance($this->container);
if (true === $virtual && false === $moduleInstance->handleVirtualProductDelivery() && false === $this->getBackendContext()) {
continue;
}
$loopResultRow = new LoopResultRow($deliveryModule);
try {
// Check if module is valid, by calling isValidDelivery(),
// or catching a DeliveryException.
if ($moduleInstance->isValidDelivery($country)) {
$postage = OrderPostage::loadFromPostage($moduleInstance->getPostage($country));
$loopResultRow->set('ID', $deliveryModule->getId())->set('CODE', $deliveryModule->getCode())->set('TITLE', $deliveryModule->getVirtualColumn('i18n_TITLE'))->set('CHAPO', $deliveryModule->getVirtualColumn('i18n_CHAPO'))->set('DESCRIPTION', $deliveryModule->getVirtualColumn('i18n_DESCRIPTION'))->set('POSTSCRIPTUM', $deliveryModule->getVirtualColumn('i18n_POSTSCRIPTUM'))->set('POSTAGE', $postage->getAmount())->set('POSTAGE_TAX', $postage->getAmountTax())->set('POSTAGE_UNTAXED', $postage->getAmount() - $postage->getAmountTax())->set('POSTAGE_TAX_RULE_TITLE', $postage->getTaxRuleTitle());
$this->addOutputFields($loopResultRow, $deliveryModule);
$loopResult->addRow($loopResultRow);
}
} catch (DeliveryException $ex) {
// Module is not available
}
}
return $loopResult;
}
示例14: parseResults
/**
* @param LoopResult $loopResult
*
* @return LoopResult
*/
public function parseResults(LoopResult $loopResult)
{
$address = $loopResult->getResultDataCollection();
$loopResultRow = new LoopResultRow($address);
$loopResultRow->set("ID", $address['Id'])->set("LABEL", $address['Label'])->set("CUSTOMER", $address['CustomerId'])->set("TITLE", $address['TitleId'])->set("COMPANY", $address['Company'])->set("FIRSTNAME", $address['Firstname'])->set("LASTNAME", $address['Lastname'])->set("ADDRESS1", $address['Address1'])->set("ADDRESS2", $address['Address2'])->set("ADDRESS3", $address['Address3'])->set("ZIPCODE", $address['Zipcode'])->set("CITY", $address['City'])->set("COUNTRY", $address['CountryId'])->set("PHONE", $address['Phone'])->set("CELLPHONE", $address['Cellphone'])->set("DEFAULT", $address['IsDefault']);
$loopResult->addRow($loopResultRow);
return $loopResult;
}
示例15: parseResults
public function parseResults(LoopResult $loopResult)
{
$item = $loopResult->getResultDataCollection();
$loopResultRow = new LoopResultRow();
$loopResultRow->set('ORDER_COMMENT', $item['comment']);
$loopResult->addRow($loopResultRow);
return $loopResult;
}