2011-07-18 17 views
6

मुझे कोई समस्या है जिससे Magento (v1.5) पंजीकृत पेपैल उपयोगकर्ता के देश के आधार पर शिपिंग की गणना नहीं करता है, जो एक पृष्ठ में परिभाषित शिपिंग नियमों के आधार पर भी है चेक आउट। पेपैल में लॉग इन करने के बाद पेपैल एक्सप्रेस का उपयोग करते समय, उपयोगकर्ता को ऑर्डर की पुष्टि करने के लिए हमारी साइट पर रीडायरेक्ट किया जाता है, कोई शिपिंग विकल्प नहीं चुना जाता है (या चयन योग्य) और इसलिए ग्राहक ऑर्डर नहीं दे सकता है।Magento 1.5 पेपैल एक्सप्रेस समीक्षा पृष्ठ शिपिंग - कोई उद्धरण उपलब्ध नहीं है

यह समाधान मेरे लिए काम नहीं करता है: http://www.magentocommerce.com/boards/viewthread/211273/

सभी मैं मिलता है: "। शिपिंग विधि क्षमा करें, कोई उद्धरण इस समय इस आदेश के लिए उपलब्ध हैं"

जब उपयोगकर्ता 'प्लेस ऑर्डर' दबाता है तो कुछ भी नहीं होता है, इसमें कोई संदेह नहीं है क्योंकि यह चुपचाप शिकायत कर रहा है कि कोई शिपिंग विधि उपलब्ध नहीं है। (बेशक एक शिपिंग विधि उपलब्ध है और सामान्य चेकआउट के माध्यम से जाने पर स्वचालित रूप से चुना जाएगा)।

अन्य फ़ोरम पोस्ट यह भी सुझाव देते हैं कि कस्टम थीम समस्या का कारण बनती हैं। मैगेंटो आधार/डिफ़ॉल्ट टेम्पलेट फ़ाइलों और लेआउट का उपयोग कर रहा है यह सुनिश्चित करने के लिए मैंने अपनी कस्टम थीम से सभी पेपैल सामग्री को हटा दिया है।

कोई भी विचार किसी को भी?

+0

क्या आपको कोई समाधान मिला? –

उत्तर

3

मुझे तीन समस्याएं मिलीं, लेकिन अंत में यह काम कर रहा है (बक्षीस अच्छी तरह खर्च किया :))। यह सुनिश्चित नहीं है कि वे सभी कहां से आए थे, लेकिन इस मॉड्यूल में Magento और विभिन्न टेम्पलेट परिवर्तनों को अपग्रेड करने के साथ यह संदेह है।

<?php if (!($_shippingRateGroups = $this->getShippingRates())): ?> 

कौन सा पढ़ना चाहिए:

<?php if (!($_shippingRateGroups = $this->getShippingRateGroups())): ?> 

दूसरी समस्या $this->getUrl समारोह, कई स्थानों पर दोहराया था पहली समस्या इस लाइन थी। मैंने इसे पूरी तरह हटा दिया, यूआरएल को कड़ी मेहनत कर दी।

अंत में, $this->getCurrentShippingRate फ़ंक्शन वर्तमान दर वापस नहीं कर रहा था। मैं इस के लिए app/code/core/Mage/Paypal/Block/Express/Review.php में getCurrentShippingRate समारोह बदल दिया है:

public function getCurrentShippingRate() 
{ 
    $this->_address = $this->_quote->getShippingAddress(); 
    return $this->_address->getShippingMethod(); 
    //return $this->_currentShippingRate; 
} 
+0

क्या आपने ऑस्कर रीयलस से कोड देखा था? – ShaunOReilly

+0

हां, लेकिन मैं पहले ही अपनी समस्या को हल कर दूंगा। हालांकि यह ओपी की मदद कर सकता है। –

4

ऑस्कर Reales से निम्नलिखित कोड हमारे लिए काम किया है, और मैं याद नहीं कर सकते जहां मैं इसे से डाउनलोड किया! दूसरा समाधान पेपैल मानक का उपयोग करना है।

/** 
* Overload of Mage_Paypal_Model_Express_Checkout to fix bug with user registration. 
    * 
    * Currently, when users choose "Register" in the buying process 
    * And then choose "Paypal Express Checkout" as a method of payment, 
    * User registration does not occur, 
    * And the order is not assigned to the client, but remains "anonymous". 
* 
* @see Mage_Paypal_Model_Express_Checkout 
* @see Mage_Checkout_Model_Type_Onepage 
* 
* @author Oscar Reales <[email protected]> 
* @author Oscar Reales <[email protected]> 
*/ 
class Mg_Paypal_Model_Express_Checkout extends Mage_Paypal_Model_Express_Checkout 
{ 

    /** 
    * Update quote when returned from PayPal 
    * @param string $token 
    */ 
    public function returnFromPaypal($token) 
    { 
     $this->_getApi(); 
     $this->_api->setToken($token) 
      ->callGetExpressCheckoutDetails(); 

     //modified 
     //do not import the billing address from Paypal, we use the data that the user entered in the onsite Checkout 
     /*$billingAddress = $this->_quote->getBillingAddress(); 
     $exportedBillingAddress = $this->_api->getExportedBillingAddress(); 
     foreach ($exportedBillingAddress->getExportedKeys() as $key) { 
      $billingAddress->setDataUsingMethod($key, $exportedBillingAddress->getData($key)); 
     }*/ 

     //modified 
     //do not import the shipping address from Paypal, we use the data that the user entered in the onsite Checkout 
     /*$exportedShippingAddress = $this->_api->getExportedShippingAddress(); 
     if (!$this->_quote->getIsVirtual()) { 
      $shippingAddress = $this->_quote->getShippingAddress(); 
      if ($shippingAddress) { 
       if ($exportedShippingAddress) { 
        foreach ($exportedShippingAddress->getExportedKeys() as $key) { 
         $shippingAddress->setDataUsingMethod($key, $exportedShippingAddress->getData($key)); 
        } 
        $shippingAddress->setCollectShippingRates(true); 
       } 

       // import shipping method 
       $code = ''; 
       if ($this->_api->getShippingRateCode()) { 
        if ($code = $this->_matchShippingMethodCode($shippingAddress, $this->_api->getShippingRateCode())) { 
         // possible bug of double collecting rates :-/ 
         $shippingAddress->setShippingMethod($code)->setCollectShippingRates(true); 
        } 
       } 
       $this->_quote->getPayment()->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_SHIPPING_METHOD, $code); 
      } 
     }*/ 
     $this->_ignoreAddressValidation(); 

     // import payment info 
     $payment = $this->_quote->getPayment(); 
     $payment->setMethod($this->_methodType); 
     Mage::getSingleton('paypal/info')->importToPayment($this->_api, $payment); 
     $payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID, $this->_api->getPayerId()) 
      ->setAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_TOKEN, $token) 
     ; 
     $this->_quote->collectTotals()->save(); 
    } 



    /** 
     * Override the parent because core code does not take into account whether the user 
     * Has chosen to register or not. It makes no difference under checkout_method chosen by the user. 
     * Simply: if the customer does not have a quote, the core code saves it as Guest, NOT_LOGGED_IN group 
     * And saves the email in the billing Address along with the order. 
     * 
     * This behavior is not what we want. We save the customer if the user has 
     * elected to register and not place the order as GUEST 
    * 
    * @param string $token 
    * @param string $shippingMethodCode 
    */ 
    public function place($token, $shippingMethodCode = null) 
    { 
     if ($shippingMethodCode) { 
      $this->updateShippingMethod($shippingMethodCode); 
     } 

     //modified 
     //check if the checkout method was chosen as a guest user or registering 
     $isNewCustomer = false; 
     switch ($this->_quote->getCheckoutMethod()) { 
      case Mage_Checkout_Model_Type_Onepage::METHOD_GUEST: 
       $this->_prepareGuestQuote(); 
       break; 
      case Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER: 
       $this->_prepareNewCustomerQuote(); 
       $isNewCustomer = true; 
       break; 
     } 
     //fin modification 

     //modified 
     //this code is no longer necessary with the previous change 
     /*if (!$this->_quote->getCustomerId()) { 
      $this->_quote->setCustomerIsGuest(true) 
       ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID) 
       ->setCustomerEmail($this->_quote->getBillingAddress()->getEmail()); 
     }*/ 
     //fin modification 

     $this->_ignoreAddressValidation(); 
     $this->_quote->collectTotals(); 
     $service = Mage::getModel('sales/service_quote', $this->_quote); 
     $service->submitAll(); 
     $this->_quote->save(); 
     $this->_recurringPaymentProfiles = $service->getRecurringPaymentProfiles(); 
     // TODO: send recurring profile emails 


     //modified 
     //after saving the order and the customer, send relevant emails if this is a new customer 
     if ($isNewCustomer) { 
      try { 
       $this->_involveNewCustomer(); 
      } catch (Exception $e) { 
       Mage::logException($e); 
      } 
     } 
     //fin modificacion 

     $order = $service->getOrder(); 
     if (!$order) { 
      return; 
     } 
     $this->_billingAgreement = $order->getPayment()->getBillingAgreement(); 

     // commence redirecting to finish payment, if paypal requires it 
     if ($order->getPayment()->getAdditionalInformation(Mage_Paypal_Model_Express_Checkout::PAYMENT_INFO_TRANSPORT_REDIRECT)) { 
      $this->_redirectUrl = $this->_config->getExpressCheckoutCompleteUrl($token); 
     } 

     switch ($order->getState()) { 
      // even after placement paypal can disallow to authorize/capture, but will wait until bank transfers money 
      case Mage_Sales_Model_Order::STATE_PENDING_PAYMENT: 
       // TODO 
       break; 
      // regular placement, when everything is ok 
      case Mage_Sales_Model_Order::STATE_PROCESSING: 
      case Mage_Sales_Model_Order::STATE_COMPLETE: 
      case Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW: 
       $order->sendNewOrderEmail(); 
       break; 
     } 
     $this->_order = $order; 
    } 


    /** 
    * Prepare quote for guest checkout order submit 
    * 
    * @see Mage_Checkout_Model_Type_Onepage::_prepareGuestQuote() 
    * 
    * @return Mg_Paypal_Model_Express_Checkout 
    */ 
    protected function _prepareGuestQuote() 
    { 
     $quote = $this->_quote; 
     $quote->setCustomerId(null) 
      ->setCustomerEmail($quote->getBillingAddress()->getEmail()) 
      ->setCustomerIsGuest(true) 
      ->setCustomerGroupId(Mage_Customer_Model_Group::NOT_LOGGED_IN_ID); 
     return $this; 
    } 


    /** 
    * Prepare quote for customer registration and customer order submit 
    * 
    * @see Mage_Checkout_Model_Type_Onepage::_prepareNewCustomerQuote() 
    * 
    */ 
    protected function _prepareNewCustomerQuote() 
    { 
     $quote  = $this->_quote; 
     $billing = $quote->getBillingAddress(); 
     $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress(); 

     //$customer = Mage::getModel('customer/customer'); 
     $customer = $quote->getCustomer(); 
     /* @var $customer Mage_Customer_Model_Customer */ 
     $customerBilling = $billing->exportCustomerAddress(); 
     $customer->addAddress($customerBilling); 
     $billing->setCustomerAddress($customerBilling); 
     $customerBilling->setIsDefaultBilling(true); 
     if ($shipping && !$shipping->getSameAsBilling()) { 
      $customerShipping = $shipping->exportCustomerAddress(); 
      $customer->addAddress($customerShipping); 
      $shipping->setCustomerAddress($customerShipping); 
      $customerShipping->setIsDefaultShipping(true); 
     } elseif ($shipping) { 
      $customerBilling->setIsDefaultShipping(true); 
     } 
     /** 
     * @todo integration with dynamica attributes customer_dob, customer_taxvat, customer_gender 
     */ 
     if ($quote->getCustomerDob() && !$billing->getCustomerDob()) { 
      $billing->setCustomerDob($quote->getCustomerDob()); 
     } 

     if ($quote->getCustomerTaxvat() && !$billing->getCustomerTaxvat()) { 
      $billing->setCustomerTaxvat($quote->getCustomerTaxvat()); 
     } 

     if ($quote->getCustomerGender() && !$billing->getCustomerGender()) { 
      $billing->setCustomerGender($quote->getCustomerGender()); 
     } 

     Mage::helper('core')->copyFieldset('checkout_onepage_billing', 'to_customer', $billing, $customer); 
     $customer->setPassword($customer->decryptPassword($quote->getPasswordHash())); 
     $customer->setPasswordHash($customer->hashPassword($customer->getPassword())); 
     $quote->setCustomer($customer) 
      ->setCustomerId(true); 
    } 


    /** 
    * Involve new customer to system 
    * 
    * @see Mage_Checkout_Model_Type_Onepage::_involveNewCustomer() 
    * 
    * @return Mg_Paypal_Model_Express_Checkout 
    */ 
    protected function _involveNewCustomer() 
    { 
     $customer = $this->_quote->getCustomer(); 
     if ($customer->isConfirmationRequired()) { 
      $customer->sendNewAccountEmail('confirmation'); 
      $url = Mage::helper('customer')->getEmailConfirmationUrl($customer->getEmail()); 
      Mage::getSingleton('customer/session')->addSuccess(
       Mage::helper('customer')->__('Account confirmation is required. Please, check your e-mail for confirmation link. To resend confirmation email please <a href="%s">click here</a>.', $url) 
      ); 
     } else { 
      $customer->sendNewAccountEmail(); 
      Mage::getSingleton('customer/session')->loginById($customer->getId()); 
     } 
     return $this; 
    } 



    /** 
     * we extend it simply because it is defined as private in the parent 
     * And if nothing changes, we have the obligation to extend to 
    */ 
    private function _ignoreAddressValidation() 
    { 
     $this->_quote->getBillingAddress()->setShouldIgnoreValidation(true); 
     if (!$this->_quote->getIsVirtual()) { 
      $this->_quote->getShippingAddress()->setShouldIgnoreValidation(true); 
     } 
    } 


} 
संबंधित मुद्दे