当前位置: 首页>>代码示例>>PHP>>正文


PHP Service::createFolderByPath方法代码示例

本文整理汇总了PHP中Pimcore\Model\Object\Service::createFolderByPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::createFolderByPath方法的具体用法?PHP Service::createFolderByPath怎么用?PHP Service::createFolderByPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Model\Object\Service的用法示例。


在下文中一共展示了Service::createFolderByPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($offerClass, $offerItemClass, $parentFolderPath)
 {
     $this->offerClass = $offerClass;
     $this->offerItemClass = $offerItemClass;
     $this->parentFolderPath = strftime($parentFolderPath, time());
     \Pimcore\Model\Object\Service::createFolderByPath($this->parentFolderPath);
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:7,代码来源:DefaultService.php

示例2: createPayment

 /**
  * Create a new Payment
  *
  * @param Payment $provider
  * @param $amount
  * @return Object\CoreShopPayment
  * @throws \Exception
  */
 public function createPayment(Payment $provider, $amount)
 {
     $payment = new Object\CoreShopPayment();
     $payment->setKey(uniqid());
     $payment->setPublished(true);
     $payment->setParent(Object\Service::createFolderByPath($this->getFullPath() . "/payments/"));
     $payment->setAmount($amount);
     $payment->setTransactionIdentifier(uniqid());
     $payment->setProvider($provider->getIdentifier());
     $payment->save();
     $this->addPayment($payment);
     return $payment;
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:21,代码来源:Order.php

示例3: prepare

 /**
  * Prepare a Cart
  *
  * @return CoreShopCart
  * @throws \Exception
  */
 public static function prepare()
 {
     $cartsFolder = Service::createFolderByPath("/coreshop/carts/" . date("Y/m/d"));
     $cart = CoreShopCart::create();
     $cart->setKey(uniqid());
     $cart->setParent($cartsFolder);
     $cart->setPublished(true);
     if (Tool::getUser() instanceof CoreShopUser) {
         $cart->setUser(Tool::getUser());
     }
     $cart->save();
     return $cart;
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:19,代码来源:Cart.php

示例4: import

 /**
  * @param $shopConfigurations Object\OnlineShopConfiguration
  */
 public function import($shopConfigurations)
 {
     if ($shopConfigurations && !is_array($shopConfigurations)) {
         $shopConfigurations = array($shopConfigurations);
     }
     $pageSize = 20;
     $page = 0;
     /** @var  $shopConfiguration Object\OnlineShopConfiguration */
     foreach ($shopConfigurations as $shopConfiguration) {
         $importDirectory = $shopConfiguration->getTrustedShopReviewsimportDirectory();
         $startTime = time();
         if ($this->logToConsole) {
             echo "Importing reviews for " . $shopConfiguration->getFullPath() . " ...\n";
         }
         /** @var  $startDate Pimcore\Date */
         $startDate = $shopConfiguration->getLastSync();
         while (true) {
             if ($this->logToConsole) {
                 echo "Page=" . $page . "\n";
             }
             $uri = "https://%s:%s@api.trustedshops.com/rest/restricted/v2/shops/%s/reviews.json?page=" . $page . "&size=" . $pageSize;
             if ($startDate) {
                 $uri .= "&startDate=" . date('Y-m-d', $startDate->getTimestamp() - 3600 * 24 * 30);
                 //get ratins from last 30 days - for some reasons trusted shop sometimes dont show all ratings imediately
             }
             $uri = sprintf($uri, $shopConfiguration->getTrustedShopUser(), $shopConfiguration->getTrustedShopPassword(), $shopConfiguration->getTrustedShopKey());
             if ($this->logToConsole) {
                 echo $uri . "\n";
             }
             $this->client->setUri($uri);
             $result = $this->client->request();
             if ($result->getStatus() != 200) {
                 $this->logger->error("Status code " . $result->getStatus(), null, null, self::COMPONENT);
                 throw new \Exception("Status Code: " . $result->getStatus());
             }
             $body = $result->getBody();
             $data = json_decode($body);
             if (!$data) {
                 $this->logger->error("Could not decode data " . $body, null, null, self::COMPONENT);
                 throw new \Exception("Could not decode data");
             }
             $response = $data->response;
             $data = $response->data;
             $shop = $data->shop;
             if ($shop->tsId != $shopConfiguration->getTrustedShopKey()) {
                 $this->logger->error("Tsid mismatch", null, null, self::COMPONENT);
                 throw new \Exception("Tsid mismatch");
             }
             $reviews = $shop->reviews;
             foreach ((array) $reviews as $review) {
                 $uid = $review->UID;
                 $comment = $review->comment;
                 $criterias = $review->criteria;
                 $consumerEmail = $review->consumerEmail;
                 $mark = $review->mark;
                 $markDescription = $review->markDescription;
                 $orderReference = $review->orderReference;
                 $changeDate = $review->changeDate;
                 $creationDate = $review->creationDate;
                 $confirmationDate = $review->confirmationDate;
                 $changeDate = $changeDate ? strtotime($changeDate) : 0;
                 $creationDate = $creationDate ? strtotime($creationDate) : 0;
                 $confirmationDate = $confirmationDate ? strtotime($confirmationDate) : 0;
                 $fc = new Object\Fieldcollection();
                 foreach ($criterias as $criteria) {
                     $mark = $criteria->mark;
                     $criteriaMarkDescription = $criteria->markDescription;
                     $type = $criteria->type;
                     $item = new Object\Fieldcollection\Data\TrustedShopCriteria();
                     $item->setMark($mark);
                     $item->setMarkDescription($criteriaMarkDescription);
                     $item->setCriteriaType($type);
                     $fc->add($item);
                 }
                 $reviewObject = $this->getReview($shopConfiguration, $uid, $consumerEmail, $creationDate);
                 $reviewObject->setShopConfig($shopConfiguration);
                 $reviewObject->setUid($uid);
                 $reviewObject->setComment($comment);
                 $reviewObject->setConsumerEmail($consumerEmail);
                 $reviewObject->setReviewConfirmationDate(new Pimcore\Date($confirmationDate));
                 $reviewObject->setReviewCreationDate(new Pimcore\Date($creationDate));
                 $reviewObject->setReviewChangeDate(new Pimcore\Date($changeDate));
                 $reviewObject->setMark($mark);
                 $reviewObject->setMarkDescription($markDescription);
                 $reviewObject->setCritera($fc);
                 $reviewObject->setOrderReference($orderReference);
                 if (!$creationDate) {
                     $path = '/unknown';
                 } else {
                     $path = '/' . date('Y/m/d', $creationDate);
                 }
                 $path = $importDirectory . $path;
                 $reviewObject->setParent(Object\Service::createFolderByPath($path));
                 $reviewObject->save();
                 if ($this->logToConsole) {
                     echo "Saved review " . $reviewObject->getId() . " " . $reviewObject->getFullPath() . "\n";
                 }
//.........这里部分代码省略.........
开发者ID:ascertain,项目名称:NGshop,代码行数:101,代码来源:Importer.php

示例5: paymentAction

 public function paymentAction()
 {
     $this->checkIsAllowed();
     $this->view->provider = Plugin::getPaymentProviders($this->cart);
     if ($this->getRequest()->isPost()) {
         $paymentProvider = reset($this->getParam("payment_provider", array()));
         foreach ($this->view->provider as $provider) {
             if ($provider->getIdentifier() == ${$paymentProvider}) {
                 $paymentProvider = $provider;
                 break;
             }
         }
         if (!$provider instanceof Payment) {
             $this->view->error = "oh shit, not found";
         } else {
             $this->session->order['paymentProvider'] = $provider;
             $order = new CoreShopOrder();
             $order->setKey(uniqid());
             $order->setParent(Service::createFolderByPath('/coreshop/orders/' . date('Y/m/d')));
             $order->setPublished(true);
             $order->setLang($this->view->language);
             $order->setCustomer($this->session->user);
             $order->setShippingAddress($this->session->order['address']['delivery']);
             $order->setBillingAddress($this->session->order['address']['billing']);
             $order->setPaymentProvider($provider->getIdentifier());
             $order->setOrderDate(new \Zend_Date());
             if ($this->session->order['shippingProvider'] instanceof Shipping) {
                 $order->setShippingProvider($this->session->order['shippingProvider']->getIdentifier());
                 $order->setShipping($this->session->order['shippingProvider']->getShipping($this->cart));
             } else {
                 $order->setShipping(0);
             }
             $order->save();
             $order->importCart($this->cart);
             $this->session->orderId = $order->getId();
             $this->_helper->viewRenderer($provider->processPayment($order, $this->view->url(array("action" => "paymentreturn"), "coreshop_checkout")), null, true);
         }
     }
     $this->view->headTitle($this->view->translate("Payment"));
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:40,代码来源:CheckoutController.php


注:本文中的Pimcore\Model\Object\Service::createFolderByPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。