Page 1 of 2

copy content module and show it on the contact us or other pages

Posted: Sun Oct 24, 2021 4:16 pm
by shopify
I want to display recently viewed items on the generic contact page that comes with phoenix. I have copied the module files of the index in the recently viewed addon but need to amend the following so it uses the contact page.

MODULE_CONTENT_INDEX_RECENTLY_VIEWED_

What would I change the index in bold above to so it points to the generic phoenix contact page? I'm not creating any new contact page, I just want to extend the recently viewed addon to include the contact page. I don't know how this bolts together and have asked addon author but was tol to post in the general forum.

Thanks

Re: copy of a content module and show it on the contact us or other pages

Posted: Sun Oct 24, 2021 4:39 pm
by raiwa
This applies for to make a copy of any content module to use it on a different page.

I suppose you made a copy and renamed these files and containing folder:

includes\languages\english\modules\content\index\cm_i_recently_viewed.php
includes\modules\content\index\templates\tpl_cm_i_recently_viewed.php
includes\modules\content\index\cm_i_recently_viewed.php

to something like:
includes\languages\english\modules\content\contact_us\cm_cu_recently_viewed.php
includes\modules\content\contact_us\templates\tpl_cm_cu_recently_viewed.php
includes\modules\content\contact_us\cm_cu_recently_viewed.php

then you need to change all instances in all 3 files from:
MODULE_CONTENT_INDEX_RECENTLY_VIEWED_
to
MODULE_CONTENT_CONTACT_US_RECENTLY_VIEWED_
(this is not critical, just something different)
and change the class name in includes\modules\content\contact_us\cm_cu_recently_viewed.php line 23
from:

Code: Select all

  class cm_i_recently_viewed extends abstract_executable_module {
to:

Code: Select all

  class cm_cu_recently_viewed extends abstract_executable_module {
Note: This is critical, the class name must match the new filename

Then make a copy of:
templates\default\includes\pages\contact_us.php
to:
templates\override\includes\pages\contact_us.php
and add the content module call where you wish to show the recently viewed content module:

Code: Select all

  <div class="row">
    <?php echo $oscTemplate->getContent('contact_us'); ?>
  </div>
where "contact_us" must match the name of the folder containing the new content module.

Re: copy of a content module and show it on the contact us or other pages

Posted: Sun Oct 24, 2021 5:03 pm
by shopify
raiwa wrote: Sun Oct 24, 2021 4:39 pm

Code: Select all

  <div class="row">
    <?php echo $oscTemplate->getContent('contact_us'); ?>
  </div>
where "contact_us" must match the name of the folder containing the new content module.
Thanks very much!

I'm not clear on the line in bold above. I have the new content module in:

\catalog\includes\modules\content\contact_us

How would I add this to the new contact_us.php file?

Re: copy content module and show it on the contact us or other pages

Posted: Sun Oct 24, 2021 5:14 pm
by shopify
It's fine I got it working now.Thanks

Re: copy content module and show it on the contact us or other pages

Posted: Tue Jan 10, 2023 12:48 am
by gabbysplaza
Hi @raiwa

I want to implement this solution as I have a similar issue. I have followed all steps but can't complete the last part as there is no login.php in the default template to copy over where you said:

Then make a copy of:
templates\default\includes\pages\contact_us.php
to:
templates\override\includes\pages\contact_us.php

.... I need a login.php for here.

Thanks

Re: copy content module and show it on the contact us or other pages

Posted: Tue Jan 10, 2023 8:39 am
by raiwa
There is no need to do this step for the login page. It is modularised and has already the content module call.
Sorry, I forgot this when I wrote the other post.
Just place your new module in:
includes/modules/content/login/
and install it in admin.

However the login.php exists in:
templates\default\includes\pages\

Re: copy content module and show it on the contact us or other pages

Posted: Tue Jan 10, 2023 6:18 pm
by gabbysplaza
@raiwa Thank you very much for this. It worked great except that the recently viewed products are showing immediately under the "Sign In" button. The "did you forget your password and reset password buttons show under the recently viewed products.

I want the recently viewed products to show at the bottom of the reset password button.

Thank you!

Re: copy content module and show it on the contact us or other pages

Posted: Tue Jan 10, 2023 7:39 pm
by raiwa
Adjust sort order and module width

Re: copy content module and show it on the contact us or other pages

Posted: Wed Jan 11, 2023 4:07 pm
by gabbysplaza
@raiwa Thank you very much for that. All looks great with recently viewed now, goodbye to a lots of whit space.

Re: copy content module and show it on the contact us or other pages

Posted: Thu Jan 12, 2023 12:33 am
by gabbysplaza
Hi @raiwa

How would I add this to the password_forgotten.php page?

I'd followed process above to and created cm_forgot_password_recently_viewed etc but I end up with two boxes of recently viewed on the login page.