簡體   English   中英

將產品添加到購物車之前的Magento活動

[英]Magento Event Before Adding a Product to Cart

我想根據客戶選擇的選項計算價格。 例如,有兩個可配置屬性length,width

在將產品添加到購物車之前,我想根據選定的長度和寬度修改價格

$finalPrice=$rrp+($length*$width)

有沒有可用於實現此目的的活動?

我會查看catalog_product_get_final_price ,有關示例用法,請參閱Mage_CatalogRule_Model_Observer::processFrontFinalPrice() 請注意,在此事件之后處理基於選項的定價; 請參閱Mage_Catalog_Model_Product_Type_Price::getFinalPrice()Mage_Catalog_Model_Product_Type_Configurable_Price::getFinalPrice()

請記住,定制此功能需要對不同的報價狀態,客戶狀態,產品類型等進行大量測試。例如,考慮首次添加到購物車中的產品,然后從購物車更新其數量。 通常有必要在幾個方法/觀察者中實現邏輯來處理所有排列。

當客戶未登錄時,在CE1.7中觸發的事件的完整列表,新購物車,簡單產品:

controller_front_init_routers

  • Mage_Cms_Controller_Router::initControllerRouters()

controller_action_predispatch

  • Mage_Log_Model_Visitor::initByRequest()
  • Mage_PageCache_Model_Observer::processPreDispatch()
  • Mage_Persistent_Model_Observer::emulateQuote()
  • Mage_Persistent_Model_Observer_Session::renewCookie()
  • Mage_Persistent_Model_Observer::checkExpirePersistentQuote()
  • Mage_Persistent_Model_Observer::emulateCustomer()

catalog_product_load_after

  • Mage_CatalogInventory_Model_Observer::addInventoryData()

custom_quote_process

  • Mage_Persistent_Model_Observer::setLoadPersistentQuote()

sales_quote_config_get_product_attributes

  • Mage_SalesRule_Model_Observer::addProductAttributes()

prepare_catalog_product_collection_prices

  • Mage_CatalogRule_Model_Observer::prepareCatalogProductCollectionPrices()

sales_quote_item_collection_products_after_load

  • Mage_CatalogInventory_Model_Observer::addInventoryDataToCollection()

sales_quote_item_qty_set_after

  • Mage_CatalogInventory_Model_Observer::checkQuoteItemQty()

sales_quote_collect_totals_before

  • Mage_Tax_Model_Observer::quoteCollectTotalsBefore()

sales_quote_address_collect_totals_before

  • Mage_Sales_Model_Observer::changeQuoteCustomerGroupId()

sales_quote_address_collect_totals_after

  • Mage_Sales_Model_Observer::restoreQuoteCustomerGroupId()

sales_quote_address_collect_totals_before

  • Mage_Sales_Model_Observer::changeQuoteCustomerGroupId()

catalog_product_get_final_price

  • Mage_CatalogRule_Model_Observer::processFrontFinalPrice()

sales_quote_address_collect_totals_after

  • Mage_Sales_Model_Observer::restoreQuoteCustomerGroupId()

sales_quote_collect_totals_after

  • Mage_Sales_Model_Observer::setQuoteCanApplyMsrp()

sales_quote_save_before

  • Mage_Persistent_Model_Observer::setQuotePersistentData()

sales_quote_save_after

  • Mage_Checkout_Model_Observer::salesQuoteSaveAfter()
  • Mage_Log_Model_Visitor::bindQuoteCreate()

sales_quote_item_save_before

  • Mage_Reports_Model_Event_Observer::checkoutCartAddProduct()

checkout_cart_add_product_complete

  • Mage_Wishlist_Model_Observer::processAddToCart()

controller_action_postdispatch

  • Mage_Log_Model_Visitor::saveByRequest()

controller_front_send_response_after

  • Mage_Persistent_Model_Observer_Session::synchronizePersistentInfo()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM