holden321 Posted September 10, 2011 Share Posted September 10, 2011 Is it possible to set two different blocks in one hook in one module? I want to place my one block before the cart module and other my block after the cart module Link to comment Share on other sites More sharing options...
PrestaShopDeveloper Posted September 11, 2011 Share Posted September 11, 2011 This is not supported by default. You can create another hook for "my block #2" by adding a record in the hooks table, adding the hook at the Controller and at the template. Then you can attach it to your Module method. Link to comment Share on other sites More sharing options...
Mark Hesketh Posted September 13, 2011 Share Posted September 13, 2011 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. Mark Link to comment Share on other sites More sharing options...
Paul C Posted September 13, 2011 Share Posted September 13, 2011 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'} {$cart_block} {plugin module='yourmodule' hook='any_other_public_function_in_module'} Paul Link to comment Share on other sites More sharing options...
george123789 Posted December 11, 2012 Share Posted December 11, 2012 (edited) thanks working Edited December 11, 2012 by george123789 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now