1

i am working on Oxid eshop custom module for shipping. i want to Change price for shipping methods on the fly. Is there any way i can get any hooks or method so is can get the interrupt for shipping methods selection? i have also came to know For running server side php code you need to extend OXID's functions, e.g. render() function for the pages you want to track. For the product page it would be "details" -> applications/controllers/details.php category page is "alist.php" and basket is basket.php

Hadi Naqvi
  • 13
  • 4
  • Welcome to Stack Overflow! You can read up on how to [ask] a question and create a [mcve]. That makes it easier for us to help you. – Katie Dec 05 '16 at 13:03

2 Answers2

1

oxBasket->_calcDeliveryCost() seems to be the function you are looking for, it calculates delivery costs based on configured delivery sets. https://github.com/OXID-eSales/oxideshop_ce/blob/b-5.3-ce/source/application/models/oxbasket.php#L903-L948

this function is called by calculateBasket() here: https://github.com/OXID-eSales/oxideshop_ce/blob/b-5.3-ce/source/application/models/oxbasket.php#L1487 which is also called, when you change shipping methods

Marat
  • 617
  • 5
  • 12
  • calculateBasket() working for me . it calculate the bucket Delivery Cost when we land to the and and also when we change the shipping method. – Hadi Naqvi Dec 05 '16 at 16:23
0

You need a module for oxbasket. In metadata:

'extend'       => array(
    'oxbasket' => 'youmodule/application/models/oxbasket_delivery'
)

and in module:

class oxbasket_delivery extends oxbasket_delivery_parent
{


    public function calculateBasket($blForceUpdate = false)
    {
        parent::calculateBasket($blForceUpdate);
        /** @var oxPrice $deliveryCost */
        $dnewDeliveryPrice = 10; // or whatever you need
        $deliveryCost = oxNew('oxprice');
        $deliveryCost->setPrice($dnewDeliveryPrice);
        $this->setCost('oxdelivery', $deliveryCost);
    }
}
Rawburner
  • 1,387
  • 11
  • 12