S05e05 - Testimonials image QUESTIONS/SUPPORT

Open to all! Ask other shopowners for help.
Post Reply
admin
Contributor
Posts: 217
Joined: Wed Oct 30, 2019 1:34 pm
Phoenix Version:
Has thanked: 20 times
Been thanked: 22 times

S05e05 - Testimonials image QUESTIONS/SUPPORT

Post by admin »

Addon:
Allows display of Testimonial Image as part of the customer testimonial

Download:
viewtopic.php?f=28&t=1075

--

Questions / Comments / Concerns

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: S05e05 - Testimonials image

Post by heatherbell »

Installed this and tested on 1.0.8.21.
Save Testimonial with image - Image exists in /pub/ and in DB but after save shows:
Notice: Trying to get property 'testimonials_image' of non-object in //includes/hooks/admin/testimonials/image.php
on line 95
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: S05e05 - Testimonials image

Post by heatherbell »

Another notice Notice: Undefined variable shows on testimonials.php shop-side. testimonial/templates/override/includes/modules/content/testimonials/tpl_cm_t_list.php
Line 5
Change from:

Code: Select all

<div class="col-sm-<?= $content_width ?> cm-t-list">
to:

Code: Select all

<div class="col-sm-<?= (int)MODULE_CONTENT_TESTIMONIALS_LIST_CONTENT_WIDTH ?> cm-t-list">
Line 9
Change from:

Code: Select all

      echo '<div class="col-sm-' . $item_width . '">' . PHP_EOL;
to:

Code: Select all

      echo '<div class="col-sm-' . (int)MODULE_CONTENT_TESTIMONIALS_LIST_CONTENT_WIDTH_EACH . '">' . PHP_EOL;
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: S05e05 - Testimonials image

Post by ecartz »

heatherbell wrote: Sat Dec 16, 2023 6:33 am Notice: Trying to get property 'testimonials_image' of non-object in //includes/hooks/admin/testimonials/image.php
on line 95
Try line 95 as

Code: Select all

    if (isset($tInfo->testimonials_image) && !Text::is_empty($tInfo->testimonials_image)) {
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: S05e05 - Testimonials image

Post by heatherbell »

ecartz wrote: Sat Dec 16, 2023 10:14 am Try line 95 as
Yes, that's fixed it.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: S05e05 - Testimonials image QUESTIONS/SUPPORT

Post by heatherbell »

In the hook file there is:

Code: Select all

  public function listen_infoBox($parameters) {
    global $tInfo;

    if (isset($tInfo->testimonials_image) && !Text::is_empty($tInfo->testimonials_image)) {
      $parameters['contents'][] = ['class' => 'text-center', 'text' => $GLOBALS['Admin']->catalog_image('pub/' . $tInfo->testimonials_image)];
    }
  }
Guess this should show the image in the infobox but does not.
Debugging shows this is because $tInfo is not set or is null.
I guess this also caused the notice in previous report.
Sorry, have not been able to find a solution.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: S05e05 - Testimonials image QUESTIONS/SUPPORT

Post by burt »

Try;

Code: Select all

  public function listen_infoBox($parameters) {
    $timage = $GLOBALS['table_definition']['info']->testimonials_image ?? '';

    if (!Text::is_empty($timage)) {
      $parameters['contents'][] = ['class' => 'text-center', 'text' => $GLOBALS['Admin']->catalog_image('pub/' . $timage)];
    }
  }
I am not here to build for you.
I am here to build with you. Let's help each other.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: S05e05 - Testimonials image QUESTIONS/SUPPORT

Post by heatherbell »

burt wrote: Fri Oct 11, 2024 8:20 pm Try;
TY, that now works as expected.
Have updated the zip with this here - viewtopic.php?p=7736#p7736


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply