Jump to content

Buyer order file location


t.zak510

Recommended Posts

I would like to display information of seller name in buyer's order detail page:

 

    /**
     * Display Sold by with seller name and their profile link on product detail page just below of price.
     *
     * @return html
     */
    public function hookDisplayProductButtons()
    {
        $idProduct = Tools::getValue('id_product');
        if (WkMpSellerProduct::getSellerProductByPsIdProduct($idProduct)) {
            if (Configuration::get('WK_MP_SHOW_SELLER_DETAILS')) {
                $this->context->smarty->assign('showDetail', Configuration::get('WK_MP_SHOW_SELLER_DETAILS'));
            }
            $this->hookActionFrontControllerSetMedia();

            return $this->fetch('module:marketplace/views/templates/hook/mp_soldby.tpl');
        }
    }

 

Not sure how to link this code with buyer's order detail

Link to comment
Share on other sites

I've done a small test, I added a function to return a "hello world" but doesn't appear in buyer's order detail

 

public function mytestfunction()
    {
			$test = "hello World";
            return $test;
        
    }

I'm editing, OrderDetailController.php is it the one I should Edit or other file?

I'm using PS 1.7.1.1

Link to comment
Share on other sites

An order may have 1 or more Products.  And each Product in the order could be a different seller, so it sounds like the first thing you need to do is obtain all of the products in the order, and then for each product obtain the seller information, right?

Then once you have the seller information for each product, then you need to show it to the end user.

I would suggest creating a module for this, however you could customize/override the OrderDetailController.php

There is only 1 module hook available in OrderDetail, and that is displayOrderDetail hook.  So you would have to work in the confines of that hook to use a module. 

If you go the customize/override approach, then I would suggest adding your Seller Information lookup to the OrderDetailController around this code (inside the IF statement of the order being validated).  Probably add all the seller information you need to display to a new array object, and then place that array in smarty so that the smarty template system has access to it.

	$order = new Order($id_order);
	if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) {
		$this->order_to_display = (new OrderPresenter())->present($order);

		$this->context->smarty->assign([
			'order' => $this->order_to_display,
			'HOOK_DISPLAYORDERDETAIL' => Hook::exec('displayOrderDetail', ['order' => $order]),
		]);
	} else {

 

Then for actually displaying it, that will depend on the approach you take above, and where exactly you want this information to appear.  If you went the module approach, then you can only show the information where ever your theme has placed the displayOrderDetail hook.

If you went the customize/override approach, then you need to edit your themes order-detail.tpl and locate place you would like it to appear.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...