コード例 #1
0
 /**
  * @param CartRepository $cartRepository
  * @param CustomerRepository $customerRepository
  * @param CartValuesTransformer $transformer
  * @return mixed
  */
 public function index(CartRepository $cartRepository, CustomerRepository $customerRepository, CartValuesTransformer $transformer)
 {
     $this->setPrimaryPath();
     $countryId = Request::get('countryId', null);
     if (!$countryId) {
         $countryId = CustomerHelper::getDefaultCountry($customerRepository);
     }
     $data['cart'] = $cartRepository->find($countryId);
     $data['cartValues'] = $data['cart']->getValues($transformer);
     return View::make('vendirun::product.cart', $data);
 }
コード例 #2
0
 /**
  * @param CustomerRepository $customerRepository
  * @return \Illuminate\Http\RedirectResponse
  */
 public function recalculateShipping(CustomerRepository $customerRepository)
 {
     $customer = $customerRepository->find();
     $countryId = NULL;
     $countryId = CustomerHelper::getDefaultCountry($customerRepository);
     if (Request::has('countryId')) {
         $countryId = Request::get('countryId');
     }
     if (Request::has('shippingaddressId')) {
         $customerCountryId = $customer->getAddressFromAddressId(Request::get('shippingaddressId'));
         if ($customerCountryId) {
             $countryId = $customerCountryId->getCountryId();
         }
     }
     return Redirect::route('vendirun.checkout', ['countryId' => $countryId, 'shippingTypeId' => Request::get('shippingTypeId', NULL)])->withInput();
 }
コード例 #3
0
ファイル: Cart.php プロジェクト: alistairshaw/vendirun-plugin
 /**
  * Update shipping prices
  */
 private function setShippingPrice()
 {
     if (!$this->countryId) {
         $this->countryId = CustomerHelper::getDefaultCountry();
     }
     $this->availableShippingTypes = ShippingCalculator::availableShippingTypes($this);
     if (!$this->shippingType && count($this->availableShippingTypes) > 0) {
         $this->shippingType = $this->availableShippingTypes[0];
     }
     $this->orderShippingPrice = ShippingCalculator::orderShippingCharge($this);
     foreach ($this->items as $item) {
         $item->setCountryId($this->countryId);
         $item->setShippingType($this->shippingType);
     }
 }