display Cart block in checkout page - php code

  • Posts: 138
  • Thank you received: 4
2 years 2 months ago #344268

-- HikaShop version -- : 4.6.1
-- Joomla version -- : 4.1.5
-- PHP version -- : 7.4
-- Browser(s) name and version -- : chrome

hi,
I want to redesign the checkout page.
I want to put the Cart block on this page. But without considering the checkout step workflow. (in my checkout step workflow : Step1:Login,Address || Step2:Shipping || Step3:Payment )
so i override show.php in template. \html\com_hikashop\checkout\show.php

PS: I don't want to use the module for that.

and i put this code:

<?php
	$this->setLayout('show_block_cart');
	echo $this->loadTemplate();
?>

it is work and displayed cart block. but have two problem:
1-when click on update quantity , make error.


2-not display image of product


Joomla Developer | am.ebrahimzadeh[at]gmail.com
Attachments:
Last edit: 2 years 2 months ago by aminweb.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 2 months ago #344290

Hi,

All the inputs, buttons and ids in each block of the checkout rely on the step id where the block is and the position id in that step.
If you load the view like that, it doesn't have a step nor a position to rely on and thus everything will be refused.
It is possible to do what you want, however, you need to :
- provide the step of another cart block from your checkout workflow in $this->workflow_step
- provide the position of that other cart block in that step in $this->module_position
- provide the options of the

$this->workflow['steps'][$this->workflow_step]['content'][$this->module_position]
in $this->options
- enclose the block in a form tag with the same action as the main one in checkout / show and with the same hidden input fields for task, cart_id and the form token.

Now, if you want to add the cart block in checkout / show I don't understand why you don't want to just use the checkout workflow for this ? I don't see any reason. It will be easier on you and you won't need any overrides. Even if you need extra HTML around the different blocks, you can use the "text" block for it. And you can add the cart view in several steps too.

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum