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

Ask the community for help and support.
shopify
Posts: 54
Joined: Tue Mar 30, 2021 3:36 pm
Has thanked: 23 times
Been thanked: 3 times

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

Post 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
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

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

Post 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.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
shopify
Posts: 54
Joined: Tue Mar 30, 2021 3:36 pm
Has thanked: 23 times
Been thanked: 3 times

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

Post 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?
shopify
Posts: 54
Joined: Tue Mar 30, 2021 3:36 pm
Has thanked: 23 times
Been thanked: 3 times

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

Post by shopify »

It's fine I got it working now.Thanks
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

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

Post 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
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

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

Post 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\
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

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

Post 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!
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

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

Post by raiwa »

Adjust sort order and module width
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

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

Post by gabbysplaza »

@raiwa Thank you very much for that. All looks great with recently viewed now, goodbye to a lots of whit space.
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

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

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