Page 1 of 1

S05e05 - Testimonials image QUESTIONS/SUPPORT

Posted: Wed Jan 05, 2022 7:19 am
by admin
Addon:
Allows display of Testimonial Image as part of the customer testimonial

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

--

Questions / Comments / Concerns

Re: S05e05 - Testimonials image

Posted: Sat Dec 16, 2023 6:33 am
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

Re: S05e05 - Testimonials image

Posted: Sat Dec 16, 2023 6:47 am
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;

Re: S05e05 - Testimonials image

Posted: Sat Dec 16, 2023 10:14 am
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)) {

Re: S05e05 - Testimonials image

Posted: Sat Dec 16, 2023 11:03 am
by heatherbell
ecartz wrote: Sat Dec 16, 2023 10:14 am Try line 95 as
Yes, that's fixed it.

Re: S05e05 - Testimonials image QUESTIONS/SUPPORT

Posted: Fri Oct 11, 2024 3:56 pm
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.

Re: S05e05 - Testimonials image QUESTIONS/SUPPORT

Posted: Fri Oct 11, 2024 8:20 pm
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)];
    }
  }

Re: S05e05 - Testimonials image QUESTIONS/SUPPORT

Posted: Sat Oct 12, 2024 4:05 am
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