Jump to content

[SOLVED] prestashop two blocks in one module


Recommended Posts

What UltraWebDev said above, you could also perhaps include the Cart block's .tpl in your module, sandwiched between your module's .tpl includes as normal, and override the original Cart blocks so it doesn't display twice.


Avoiding any of this, and if the work is merely for aesthetics, you could rearrange hookRightColumn's blocks with CSS. Manipulating the document flow through clever use of things such as Floats, Block/Inline elements, or Absolute/Relative positioning would get the job done without having to touch Prestashop's overrides/modules/hooks.



Link to comment
Share on other sites

You could also try out my "plugins" (details on my site) and then you would just need to place the following in the template file that contains the right column:


{plugin module='yourmodule' hook='any_public_function_in_module'}
{plugin module='blockcart' hook='rightColumn'}
{plugin module='yourmodule' hook='any_other_public_function_in_module'}


Obviously you will need to unhook the cart block from its default location to prevent it from displaying twice. In your own module you don't need to register ANY hooks in the install() function.


Another trick you can use is to "pre-fetch" the cart block. You can include the following in header.tpl for example:


{capture name='cart_pre_force' assign='cart_block'}{plugin module='blockcart' hook='rightColumn'}{/capture}


That means that you now have access to all the smarty variables defined by the cart block - so you can display cart details in the header (e.g. total price of goods in cart, quantities in cart etc.)


To render the right column now though you would use the following instead:


{plugin module='yourmodule' hook='any_public_function_in_module'}
{plugin module='yourmodule' hook='any_other_public_function_in_module'}



Link to comment
Share on other sites

  • 1 year later...

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...