示例#1
0
 public function update_status(OrderEvent $event)
 {
     if ($event->getOrder()->getDeliveryModuleId() === LocalPickup::getModCode()) {
         if ($event->getOrder()->isSent()) {
             $contact_email = ConfigQuery::read('store_email');
             if ($contact_email) {
                 $message = MessageQuery::create()->filterByName('order_confirmation_localpickup')->findOne();
                 if (false === $message) {
                     throw new \Exception("Failed to load message 'order_confirmation_localpickup'.");
                 }
                 $order = $event->getOrder();
                 $customer = $order->getCustomer();
                 $store = ConfigQuery::create();
                 $country = CountryQuery::create()->findPk($store->read("store_country"));
                 $country = CountryI18nQuery::create()->filterById($country->getId())->findOneByLocale($order->getLang()->getLocale())->getTitle();
                 $this->parser->assign('order_id', $order->getId());
                 $this->parser->assign('order_ref', $order->getRef());
                 $this->parser->assign('store_name', $store->read("store_name"));
                 $this->parser->assign('store_address1', $store->read("store_address1"));
                 $this->parser->assign('store_address2', $store->read("store_address2"));
                 $this->parser->assign('store_address3', $store->read("store_address3"));
                 $this->parser->assign('store_zipcode', $store->read("store_zipcode"));
                 $this->parser->assign('store_city', $store->read("store_city"));
                 $this->parser->assign('store_country', $country);
                 $message->setLocale($order->getLang()->getLocale());
                 $instance = \Swift_Message::newInstance()->addTo($customer->getEmail(), $customer->getFirstname() . " " . $customer->getLastname())->addFrom($contact_email, ConfigQuery::read('store_name'));
                 // Build subject and body
                 $message->buildMessage($this->parser, $instance);
                 $this->getMailer()->send($instance);
             }
         }
     }
 }
示例#2
0
 public function checkDuplicateName($value, ExecutionContextInterface $context)
 {
     $config = ConfigQuery::create()->findOneByName($value);
     if ($config) {
         $context->addViolation(Translator::getInstance()->trans('A variable with name "%name" already exists.', array('%name' => $value)));
     }
 }
示例#3
0
 protected function getExistingObject()
 {
     $config = ConfigQuery::create()->findOneById($this->getRequest()->get('variable_id'));
     if (null !== $config) {
         $config->setLocale($this->getCurrentEditionLocale());
     }
     return $config;
 }
示例#4
0
 public function __construct()
 {
     $configList = ConfigQuery::create()->filterByName(['payline_merchantId', 'payline_merchantAccesskey', 'payline_contractNumber', 'payline_env', 'payline_minimumAmount', 'payline_maximumAmount'])->find();
     /** @var Config $config */
     foreach ($configList as $config) {
         $this->{str_replace('payline_', '', $config->getName())} = $config->getValue();
     }
 }
示例#5
0
 /**
  * Delete a configuration entry
  *
  * @param \Thelia\Core\Event\Config\ConfigDeleteEvent $event
  * @param $eventName
  * @param EventDispatcherInterface $dispatcher
  */
 public function delete(ConfigDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     if (null !== ($config = ConfigQuery::create()->findPk($event->getConfigId()))) {
         if (!$config->getSecured()) {
             $config->setDispatcher($dispatcher)->delete();
             $event->setConfig($config);
         }
     }
 }
示例#6
0
 public function buildModelCriteria()
 {
     $id = $this->getId();
     $name = $this->getVariable();
     $secured = $this->getSecured();
     $exclude = $this->getExclude();
     $search = ConfigQuery::create();
     $this->configureI18nProcessing($search);
     if (!is_null($id)) {
         $search->filterById($id);
     }
     if (!is_null($name)) {
         $search->filterByName($name);
     }
     if (!is_null($exclude)) {
         $search->filterById($exclude, Criteria::NOT_IN);
     }
     if ($this->getHidden() != BooleanOrBothType::ANY) {
         $search->filterByHidden($this->getHidden() ? 1 : 0);
     }
     if (!is_null($secured) && $secured != BooleanOrBothType::ANY) {
         $search->filterBySecured($secured ? 1 : 0);
     }
     $orders = $this->getOrder();
     foreach ($orders as $order) {
         switch ($order) {
             case 'id':
                 $search->orderById(Criteria::ASC);
                 break;
             case 'id_reverse':
                 $search->orderById(Criteria::DESC);
                 break;
             case 'name':
                 $search->orderByName(Criteria::ASC);
                 break;
             case 'name_reverse':
                 $search->orderByName(Criteria::DESC);
                 break;
             case 'title':
                 $search->addAscendingOrderByColumn('i18n_TITLE');
                 break;
             case 'title_reverse':
                 $search->addDescendingOrderByColumn('i18n_TITLE');
                 break;
             case 'value':
                 $search->orderByValue(Criteria::ASC);
                 break;
             case 'value_reverse':
                 $search->orderByValue(Criteria::DESC);
                 break;
         }
     }
     return $search;
 }
示例#7
0
文件: Atos.php 项目: bibich/Atos
 public function update($currentVersion, $newVersion, ConnectionInterface $con = null)
 {
     // Migrate old configuration
     if (null === self::getConfigValue('atos_merchantId', null)) {
         if (null !== ($atosConfigs = ConfigQuery::create()->filterByName('atos_%', Criteria::LIKE)->find())) {
             /** @var Config $atosConfig */
             foreach ($atosConfigs as $atosConfig) {
                 Atos::setConfigValue($atosConfig->getName(), $atosConfig->getValue());
                 $atosConfig->delete($con);
             }
         }
     }
     parent::update($currentVersion, $newVersion, $con);
 }
示例#8
0
 public function testFormatSimpleQueryWithAliases()
 {
     /**
      * Aliases must not be case sensitive
      */
     $aliases = ["coNfiG.iD" => "id", "conFig.NaMe" => "name", "CoNfIg.Value" => "value", "config.hidden" => "hidden", "ConFig.Secured" => "secured"];
     $formatterData = new FormatterData($aliases);
     $query = ConfigQuery::create()->limit(1);
     $formattedData = $formatterData->loadModelCriteria($query)->getData();
     /** @var \Thelia\Model\Config $result */
     $result = $query->findOne();
     $formattedResult = [["id" => $result->getId(), "name" => $result->getName(), "value" => $result->getValue(), "config.created_at" => $result->getCreatedAt(), "config.updated_at" => $result->getUpdatedAt(), "hidden" => $result->getHidden(), "secured" => $result->getHidden()]];
     $this->assertEquals($formattedResult, $formattedData);
 }
示例#9
0
文件: PopIn.php 项目: bcbrr/PopIn
 /**
  * Create and save the id of the pop-in images folder if necessary.
  *
  * @throws \Exception
  * @throws PropelException
  */
 protected function createPopInImageFolder()
 {
     $imageFolderIdConfig = ConfigQuery::create()->findOneByName(static::CONF_KEY_IMAGE_FOLDER_ID);
     if (null !== $imageFolderIdConfig && null !== FolderQuery::create()->findPk($imageFolderIdConfig->getValue())) {
         // we already have and know our images folder
         return;
     }
     Propel::getConnection()->beginTransaction();
     try {
         // create the folder
         $folder = new Folder();
         $folder->setVisible(true);
         /** @var Lang $lang */
         foreach (LangQuery::create()->find() as $lang) {
             $localizedTitle = Translator::getInstance()->trans("Pop-in images", [], static::MESSAGE_DOMAIN_BO, $lang->getLocale(), false);
             if ($localizedTitle == "") {
                 continue;
             }
             $folder->setLocale($lang->getLocale())->setTitle($localizedTitle);
         }
         $folder->save();
         // save the folder id in configuration
         if ($folder->getId() !== null) {
             $config = new Config();
             $config->setName(static::CONF_KEY_IMAGE_FOLDER_ID)->setValue($folder->getId())->setHidden(false);
             /** @var Lang $lang */
             foreach (LangQuery::create()->find() as $lang) {
                 $localizedTitle = Translator::getInstance()->trans("Pop-in images folder id", [], static::MESSAGE_DOMAIN_BO, $lang->getLocale(), false);
                 if ($localizedTitle == "") {
                     continue;
                 }
                 $config->setLocale($lang->getLocale())->setTitle($localizedTitle);
             }
             $config->save();
         }
     } catch (\Exception $e) {
         Propel::getConnection()->rollBack();
         throw $e;
     }
     Propel::getConnection()->commit();
 }
示例#10
0
文件: Config.php 项目: margery/thelia
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      ConnectionInterface $con
  * @return void
  * @throws PropelException
  * @see Config::setDeleted()
  * @see Config::isDeleted()
  */
 public function delete(ConnectionInterface $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getServiceContainer()->getWriteConnection(ConfigTableMap::DATABASE_NAME);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = ChildConfigQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
示例#11
0
 /**
  * Get the associated ChildConfig object
  *
  * @param      ConnectionInterface $con Optional Connection object.
  * @return                 ChildConfig The associated ChildConfig object.
  * @throws PropelException
  */
 public function getConfig(ConnectionInterface $con = null)
 {
     if ($this->aConfig === null && $this->id !== null) {
         $this->aConfig = ChildConfigQuery::create()->findPk($this->id, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aConfig->addConfigI18ns($this);
            */
     }
     return $this->aConfig;
 }
示例#12
0
 private function deleteConfig(InputInterface $input, OutputInterface $output)
 {
     $varName = $input->getArgument("name");
     if (null === $varName) {
         $output->writeln("<error>Need argument 'name' for get command</error>");
         return;
     }
     $var = ConfigQuery::create()->findOneByName($varName);
     if (null === $var) {
         $output->writeln(sprintf("<error>Unknown variable '%s'</error>", $varName));
     } else {
         $var->delete();
         $output->writeln(sprintf("<info>Variable '%s' has been deleted</info>", $varName));
     }
 }
示例#13
0
文件: end.php 项目: GuiminZHOU/thelia
         unset($query["admin_password_verif"]);
     }
     header(sprintf('location: config.php?%s', http_build_query($query)));
     exit;
     // Don't forget to exit, otherwise, the script will continue to run.
 }
 if ($_SESSION['install']['step'] == 5) {
     // Check now if we can create the App.
     $thelia = new \Thelia\Core\Thelia("install", true);
     $thelia->boot();
     $admin = new \Thelia\Model\Admin();
     $admin->setLogin($_POST['admin_login'])->setPassword($_POST['admin_password'])->setFirstname('admin')->setLastname('admin')->setLocale(empty($_POST['admin_locale']) ? 'en_US' : $_POST['admin_locale'])->setLocale($_POST['admin_email'])->save();
     \Thelia\Model\ConfigQuery::create()->filterByName('store_email')->update(array('Value' => $_POST['store_email']));
     \Thelia\Model\ConfigQuery::create()->filterByName('store_notification_emails')->update(array('Value' => $_POST['store_email']));
     \Thelia\Model\ConfigQuery::create()->filterByName('store_name')->update(array('Value' => $_POST['store_name']));
     \Thelia\Model\ConfigQuery::create()->filterByName('url_site')->update(array('Value' => $_POST['url_site']));
     $lang = \Thelia\Model\LangQuery::create()->findOneByLocale(empty($_POST['shop_locale']) ? "en_US" : $_POST['shop_locale']);
     if (null !== $lang) {
         $lang->toggleDefault();
     }
     $secret = \Thelia\Tools\TokenProvider::generateToken();
     \Thelia\Model\ConfigQuery::write('form.secret', $secret, 0, 0);
 }
 //clean up cache directories
 $fs = new \Symfony\Component\Filesystem\Filesystem();
 $fs->remove(THELIA_ROOT . '/cache/prod');
 $fs->remove(THELIA_ROOT . '/cache/dev');
 $fs->remove(THELIA_ROOT . '/cache/install');
 $request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
 $_SESSION['install']['step'] = $step;
 // Retrieve the website url
示例#14
0
 private function domainActivation($activate)
 {
     if (null !== ($response = $this->checkAuth(AdminResources::LANGUAGE, array(), AccessManager::UPDATE))) {
         return $response;
     }
     ConfigQuery::create()->filterByName('one_domain_foreach_lang')->update(array('Value' => $activate));
     return $this->generateRedirectFromRoute('admin.configuration.languages');
 }
示例#15
0
 /**
  * Performs an INSERT on the database, given a Config or Criteria object.
  *
  * @param mixed               $criteria Criteria or Config object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(ConfigTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from Config object
     }
     if ($criteria->containsKey(ConfigTableMap::ID) && $criteria->keyContainsValue(ConfigTableMap::ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . ConfigTableMap::ID . ')');
     }
     // Set the correct dbName
     $query = ConfigQuery::create()->mergeWith($criteria);
     try {
         // use transaction because $criteria could contain info
         // for more than one table (I guess, conceivably)
         $con->beginTransaction();
         $pk = $query->doInsert($con);
         $con->commit();
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
     return $pk;
 }
示例#16
0
 /**
  * No operation done on source file -> link !
  */
 public function testProcessDocumentSymlink()
 {
     $event = new DocumentEvent($this->request);
     $event->setSourceFilepath(__DIR__ . "/assets/documents/sources/test-document-2.txt");
     $event->setCacheSubdirectory("tests");
     $document = new Document($this->getFileManager());
     // mock cache configuration.
     $config = ConfigQuery::create()->filterByName(Document::CONFIG_DELIVERY_MODE)->findOne();
     if ($config != null) {
         $oldval = $config->getValue();
         $config->setValue('symlink')->save();
     }
     $document->processDocument($event);
     if ($config != null) {
         $config->setValue($oldval)->save();
     }
     $imgdir = ConfigQuery::read('document_cache_dir_from_web_root');
     $this->assertFileExists(THELIA_WEB_DIR . "/{$imgdir}/tests/test-document-2.txt");
 }
示例#17
0
 public static function setUpBeforeClass()
 {
     ConfigQuery::create()->filterByName('foo')->delete();
 }
示例#18
0
 /**
  * No operation done on source file -> copie !
  */
 public function testProcessImageWithoutAnyTransformationsSymlink()
 {
     $event = new ImageEvent($this->request);
     $event->setDispatcher($this->getDispatcher());
     $event->setSourceFilepath(__DIR__ . "/assets/images/sources/test-image-9.png");
     $event->setCacheSubdirectory("tests");
     $image = new Image($this->getFileManager());
     // mock cache configuration.
     $config = ConfigQuery::create()->filterByName('original_image_delivery_mode')->findOne();
     if ($config != null) {
         $oldval = $config->getValue();
         $config->setValue('symlink')->save();
     }
     $image->processImage($event);
     if ($config != null) {
         $config->setValue($oldval)->save();
     }
     $imgdir = ConfigQuery::read('image_cache_dir_from_web_root');
     $this->assertFileExists(THELIA_WEB_DIR . "/{$imgdir}/tests/test-image-9.png");
 }
 protected function assertVariableEqual($name, $value, $secured = 0, $hidden = 1)
 {
     $var = ConfigQuery::create()->findOneByName($name);
     $this->assertNotNull($var, sprintf("Variable '%s' should exist", $name));
     $this->assertEquals($var->getName(), $name, sprintf("Variable '%s' should have name '%s' :/", $var->getName(), $name));
     $this->assertEquals($var->getValue(), $value, sprintf("Variable '%s' should have value '%s' ('%s' found)", $name, $value, $var->getValue()));
     $this->assertEquals($var->getSecured(), $secured, sprintf("Variable '%s' should be %s secured", $name, $secured === 1 ? '' : 'NOT'));
     $this->assertEquals($var->getHidden(), $hidden, sprintf("Variable '%s' should be %s hidden", $name, $hidden === 1 ? '' : 'NOT'));
 }
示例#20
0
文件: Lang.php 项目: margery/thelia
 public function defaultBehavior(LangDefaultBehaviorEvent $event)
 {
     ConfigQuery::create()->filterByName('default_lang_without_translation')->update(array('Value' => $event->getDefaultBehavior()));
 }
 /**
  * @return string
  */
 public function doExport()
 {
     /**
      * Define the cache
      */
     $cache = [];
     $cache["brand"] = [];
     $cache["category"] = [];
     $cache["breadcrumb"] = [];
     $cache["feature"]["title"] = [];
     $cache["feature"]["value"] = [];
     $cache["attribute"]["title"] = [];
     $cache["attribute"]["value"] = [];
     $fakeCartItem = new CartItem();
     $fakeCart = new Cart();
     $fakeCart->addCartItem($fakeCartItem);
     /** @var \Thelia\Model\Country $country */
     $country = CountryQuery::create()->findOneById(ConfigQuery::create()->read('store_country', null));
     $deliveryModuleModelId = ShoppingFluxConfigQuery::getDeliveryModuleId();
     $deliveryModuleModel = ModuleQuery::create()->findPk($deliveryModuleModelId);
     /** @var \Thelia\Module\AbstractDeliveryModule $deliveryModule */
     $deliveryModule = $deliveryModuleModel->getModuleInstance($this->container);
     /**
      * Build fake Request to inject in the module
      */
     $fakeRequest = new Request();
     $fakeRequest->setSession((new FakeSession())->setCart($fakeCart));
     $deliveryModule->setRequest($fakeRequest);
     /**
      * Currency
      */
     $currency = Currency::getDefaultCurrency();
     /**
      * Load ecotax
      */
     $ecotax = TaxQuery::create()->findPk(ShoppingFluxConfigQuery::getEcotaxRuleId());
     /**
      * If there's a problem in the configuration, load a fake tax
      */
     if ($ecotax === null) {
         $ecotax = new Tax();
         $ecotax->setType('\\Thelia\\TaxEngine\\TaxType\\FixAmountTaxType')->setRequirements(array('amount' => 0));
     }
     /**
      * Load the tax instance
      */
     $ecotaxInstance = $ecotax->getTypeInstance();
     // Compatibility with Thelia <= 2.0.2
     $ecotaxInstance->loadRequirements($ecotax->getRequirements());
     // We can pass any product as Argument, it is not used
     $ecotax = $ecotaxInstance->fixAmountRetriever(new Product());
     /** @var \Thelia\Model\Product $product */
     foreach ($this->getData() as $product) {
         $product->setLocale($this->locale);
         $node = $this->xml->addChild("produit");
         /**
          * Parent id
          */
         $node->addChild("id", $product->getId());
         $node->addChild("nom", $product->getTitle());
         $node->addChild("url", URL::getInstance()->absoluteUrl("/", ["view" => "product", "product_id" => $product->getId()]));
         $node->addChild("description-courte", $product->getChapo());
         $node->addChild("description", $product->getDescription());
         /**
          * Images URL
          */
         $imagesNode = $node->addChild("images");
         /** @var \Thelia\Model\ProductImage $productImage */
         foreach ($product->getProductImages() as $productImage) {
             $imagesNode->addChild("image", URL::getInstance()->absoluteUrl("/shoppingflux/image/" . $productImage->getId()));
         }
         /**
          * Product Brand
          */
         if ($product->getBrand()) {
             $brand = $product->getBrand();
             $brand->setLocale($this->locale);
             if (!array_key_exists($brandId = $brand->getId(), $cache["brand"])) {
                 $cache["brand"][$brandId] = $brand->getTitle();
             }
             $node->addChild("marque", $cache["brand"][$brandId]);
         } else {
             $node->addChild("marque", null);
         }
         $node->addChild("url-marque");
         /**
          * Compute breadcrumb
          */
         $category = $product->getCategories()[0];
         $category->setLocale($this->locale);
         if (!array_key_exists($categoryId = $category->getId(), $cache["category"])) {
             $cache["category"][$categoryId] = $category->getTitle();
             $breadcrumb = [];
             do {
                 $category->setLocale($this->locale);
                 $breadcrumb[] = $category->getTitle();
             } while (null !== ($category = CategoryQuery::create()->findPk($category->getParent())));
             $reversedBreadcrumb = array_reverse($breadcrumb);
             $reversedBreadcrumb[] = $product->getTitle();
             $cache["breadcrumb"][$categoryId] = implode(" > ", $reversedBreadcrumb);
         }
         $node->addChild("rayon", $cache["category"][$categoryId]);
         $node->addChild("fil-ariane", $cache["breadcrumb"][$categoryId]);
         /**
          * Features
          */
         $featuresNode = $node->addChild("caracteristiques");
         foreach ($product->getFeatureProducts() as $featureProduct) {
             if ($featureProduct->getFeatureAv() !== null && $featureProduct->getFeature() !== null) {
                 if (!array_key_exists($featureId = $featureProduct->getFeature()->getId(), $cache["feature"]["title"])) {
                     $featureProduct->getFeatureAv()->setLocale($this->locale);
                     $featureProduct->getFeature()->setLocale($this->locale);
                     $cache["feature"]["title"][$featureId] = trim(preg_replace("#[^a-z0-9_\\-]#i", "_", $featureProduct->getFeature()->getTitle()), "_");
                     $cache["feature"]["value"][$featureId] = $featureProduct->getFeatureAv()->getTitle();
                 }
                 $featuresNode->addChild($cache["feature"]["title"][$featureId], $cache["feature"]["value"][$featureId]);
             }
         }
         /**
          * Compute VAT
          */
         $taxRuleCountry = TaxRuleCountryQuery::create()->filterByTaxRule($product->getTaxRule())->findOne();
         $tax = $taxRuleCountry->getTax();
         /** @var \Thelia\TaxEngine\TaxType\PricePercentTaxType $taxType*/
         $taxType = $tax->getTypeInstance();
         if (array_key_exists("percent", $taxRequirements = $taxType->getRequirements())) {
             $node->addChild("tva", $taxRequirements["percent"]);
         }
         /**
          * Compute product sale elements
          */
         $productSaleElements = $product->getProductSaleElementss();
         $psesNode = $node->addChild("declinaisons");
         /** @var \Thelia\Model\ProductSaleElements $pse */
         foreach ($productSaleElements as $pse) {
             /**
              * Fake the cart so that module::getPostage() returns the price
              * for only one object
              */
             $fakeCartItem->setProductSaleElements($pse);
             /**
              * If the object is too heavy, don't export it
              */
             try {
                 $shipping_price = $deliveryModule->getPostage($country);
             } catch (DeliveryException $e) {
                 continue;
             }
             $productPrice = $pse->getPricesByCurrency($currency);
             $pse->setVirtualColumn("price_PRICE", $productPrice->getPrice());
             $pse->setVirtualColumn("price_PROMO_PRICE", $productPrice->getPromoPrice());
             $deliveryTimeMin = null;
             $deliveryTimeMax = null;
             $pseNode = $psesNode->addChild("declinaison");
             /**
              * Child id
              */
             $pseNode->addChild("id", $product->getId() . "_" . $pse->getId());
             $pseNode->addChild("prix-ttc", $pse->getPromo() ? $pse->getPromoPrice() : $pse->getPrice());
             $pseNode->addChild("prix-ttc-barre", $pse->getPromo() ? $pse->getPrice() : null);
             $pseNode->addChild("quantite", $pse->getQuantity());
             $pseNode->addChild("ean", $pse->getEanCode());
             $pseNode->addChild("poids", $pse->getWeight());
             $pseNode->addChild("ecotaxe", $ecotax);
             $pseNode->addChild("frais-de-port", $shipping_price);
             $pseNode->addChild("delai-livraison-mini", $deliveryTimeMin);
             $pseNode->addChild("delai-livraison-maxi", $deliveryTimeMax);
             $pseAttrNode = $pseNode->addChild("attributs");
             /** @var \Thelia\Model\AttributeCombination $attr */
             foreach ($pse->getAttributeCombinations() as $attr) {
                 if ($attr->getAttribute() !== null && $attr->getAttributeAv() !== null) {
                     if (!array_key_exists($attributeId = $attr->getAttribute()->getId(), $cache["attribute"]["title"])) {
                         $attr->getAttribute()->setLocale($this->locale);
                         $attr->getAttributeAv()->setLocale($this->locale);
                         $cache["attribute"]["title"][$attributeId] = trim(preg_replace("#[^a-z0-9_\\-]#i", "_", $attr->getAttribute()->getTitle()), "_");
                         $cache["attribute"]["value"][$attributeId] = $attr->getAttributeAv()->getTitle();
                     }
                     $pseAttrNode->addChild($cache["attribute"]["title"][$attributeId], $cache["attribute"]["value"][$attributeId]);
                 }
             }
             $pseNode->addChild("promo-de");
             $pseNode->addChild("promo-a");
         }
     }
     /**
      * Then return a well formed string
      */
     $dom = new \DOMDocument("1.0");
     $dom->preserveWhiteSpace = false;
     $dom->formatOutput = true;
     $dom->loadXML($this->xml->asXML());
     return $dom->saveXML();
 }