Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
DivaVocals
Found a better solution to this issue than what I posted previously..
Issue:
If you have both Tabbed Products Pro, and Zen Lightbox installed AND your products have model numbers defined, the problem outlined above will manifest itself.
To fix this in the
includes/modules/pages/product_reviews/header_php.php file replace this:
Code:
if (zen_not_null($review->fields['products_model'])) {
$products_name = $review->fields['products_name'] . '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_name = $review->fields['products_name'];
}
with this:
Code:
if (TPP_GLOBAL_ENABLE_TABS == '1') {
if (zen_not_null($review->fields['products_model'])) {
$products_name = $review->fields['products_name'];
}
} else {
if (zen_not_null($review->fields['products_model'])) {
$products_name = $review->fields['products_name'] . '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_name = $review->fields['products_name'];
}
}
What this change does:
If you have Tabbed Products Pro and Zen Lightbox installed, the model number field will NOT display on the product reviews page.
I realize this is pretty much a bandaid solution, but coming up with a solution that allows the product model field to display when both TPP and Zen Lightbox are installed and active is over my paygrade to execute. I don't know if the issue is in the TPP code, or the ZenLight box code or if a change needs to be made in both. Again, someone smarter than me will need to figure this out. So I am sharing a down and dirty solution that works.
Okay.. I think I found it.. the key to the answer was in the includes/modules/pages/product_reviews_write/header_php.php file..
The includes/modules/pages/product_reviews/header_php.php file was using different code to display the model number. And this code would display the model number incorrectly when Zen Lightbox (or Zen Colorbox) was installed and active..
Here's the correct fix:
To fix this in the includes/modules/pages/product_reviews/header_php.php file replace this:
Code:
if (zen_not_null($review->fields['products_model'])) {
$products_name = $review->fields['products_name'] . '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_name = $review->fields['products_name'];
}
with this:
Code:
$products_name = $review->fields['products_name'];
if ($review->fields['products_model'] != '') {
$products_model = '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_model = '';
}
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
DivaVocals
Okay.. I think I found it.. the key to the answer was in the
includes/modules/pages/product_reviews_write/header_php.php file..
The
includes/modules/pages/product_reviews/header_php.php file was using different code to display the model number. And this code would display the model number incorrectly when Zen Lightbox (or Zen Colorbox) was installed and active..
Here's the correct fix:
To fix this in the
includes/modules/pages/product_reviews/header_php.php file replace this:
Code:
if (zen_not_null($review->fields['products_model'])) {
$products_name = $review->fields['products_name'] . '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_name = $review->fields['products_name'];
}
with this:
Code:
$products_name = $review->fields['products_name'];
if ($review->fields['products_model'] != '') {
$products_model = '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_model = '';
}
Regarding the location that this was installed, and with consideration of default database settings of a new install, would the products_model value be set to NULL as a default or blank as the new code suggests? (Ie. Was this field in the tested database one that automatically fills with a blank when no model number is provided or as a Null as the original/core code suggests?) Perhaps the logic shold be switched such that it tests if null || == "" to show without the model_number info else show with the model_number. That way the database could have either setting independent of version history and the fix would still work.
Or I guess could keep the same logic sequence and use an AND (&&) for both tests because I didn't think that NULL evaluated to "".
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
mc12345678
Regarding the location that this was installed, and with consideration of default database settings of a new install, would the products_model value be set to NULL as a default or blank as the new code suggests? (Ie. Was this field in the tested database one that automatically fills with a blank when no model number is provided or as a Null as the original/core code suggests?) Perhaps the logic shold be switched such that it tests if null || == "" to show without the model_number info else show with the model_number. That way the database could have either setting independent of version history and the fix would still work.
Blank not null.. and this code isn't new, I simply ported over the same code that is used on the "write reviews" page so that "write reviews" and "read reviews" handle the display of the product name and model number the exact same way. Trust me.. what I posted IS the right answer..:smile: The "write reviews" page worked correctly, the "read reviews" page did not.. So porting over the "write reviews" code solves the issue on the "read reviews" page..
Now is a better method for both pages to display the product name and model number?? Dunno.. there very well might be.. But the issue here is that the code being used by "write reviews" is not problematic, and the code on the "read reviews" is. My solution addresses that much..
Are improvements to this code on both pages possible?? Maybe.. I'll let someone smarter than I figure that out.. it not the issue I was trying to solve..:smile:
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
DivaVocals
Blank not null.. and this code isn't new, I simply ported over the same code that is used on the "write reviews" page so that "write reviews" and "read reviews" handle the display of the product name and model number the exact same way. Trust me.. what I posted IS the right answer..:smile: The "write reviews" page worked correctly, the "read reviews" page did not.. So porting over the "write reviews" code solves the issue on the "read reviews" page..
Now is a better method for both pages to display the product name and model number?? Dunno.. there very well might be.. But the issue here is that the code being used by "write reviews" is not problematic, and the code on the "read reviews" is. My solution addresses that much..
Are improvements to this code on both pages possible?? Maybe.. I'll let someone smarter than I figure that out.. it not the issue I was trying to solve..:smile:
Gotcha. There is LOTS of code involved to give us this highly useful, functional, open source product. Bound to be something minor somewhere that could be different/incorrectly present something. Being a questioning type individual, still wonder if there is something in ZLB that should be modified to allow capturing of that change to the core/default code.
I guess though, with the above fix, the problem that many have lived with will go away, and if someone really wants the model info to show up adjacent to the product name in ZLB while on the review page or elsewhere, then they can add that variable if they so desire.
Good catch everyone, good code review, and glad to see the community pitch in.
Re: Zen Lightbox addon [Support Thread]
change the code:
/includes/modules/pages/product_reviews/header_php.php
find:
PHP Code:
if (zen_not_null($review->fields['products_model'])) {
$products_name = $review->fields['products_name'] . '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_name = $review->fields['products_name'];
}
change to:
PHP Code:
$products_name = $review->fields['products_name'];
if ($review->fields['products_model'] != '') {
$products_model = '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_model = '';
}
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
mc12345678
Gotcha. There is LOTS of code involved to give us this highly useful, functional, open source product. Bound to be something minor somewhere that could be different/incorrectly present something. Being a questioning type individual, still wonder if there is something in ZLB that should be modified to allow capturing of that change to the core/default code.
I guess though, with the above fix, the problem that many have lived with will go away, and if someone really wants the model info to show up adjacent to the product name in ZLB while on the review page or elsewhere, then they can add that variable if they so desire.
Good catch everyone, good code review, and glad to see the community pitch in.
Why??? This issue REALLY ISN'T a ZLB issue.. Activating ZLB simply reveals an issue in Zen Cart's core code. The core code used to manage the display of the product name and model number on the "read reviews" page SHOULD match the code used for the "write reviews" page. If it does, then ZLB won't behave incorrectly on the "read reviews" page. The ONLY thing ZLB should do on ANY of the reviews pages (and does do) is to display the product image inside a lightbox. There's no change to ZLB required.. a change to the Zen Cart core code IS needed, and the only change to ZLB should be an instruction in the ZLB readme that this change needs to be made ONLY if the shopowners uses reviews and model numbers on their products..
The code change I posted SHOULD be included in the Zen Cart core, and I will report my findings on this to the admin to that effect.
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
DivaVocals
Not a ZLB issue or TPP issue.. See my post above this.. It's a Zen Cart core code issue which is "aggravated" by ZLB..
Ultimately ZLB code messed with Zen Stock Code :P
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
rbarbour
change the code:
/includes/modules/pages/product_reviews/header_php.php
find:
PHP Code:
if (zen_not_null($review->fields['products_model'])) {
$products_name = $review->fields['products_name'] . '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_name = $review->fields['products_name'];
}
change to:
PHP Code:
$products_name = $review->fields['products_name'];
if ($review->fields['products_model'] != '') {
$products_model = '<br /><span class="smallText">[' . $review->fields['products_model'] . ']</span>';
} else {
$products_model = '';
}
You apparently missed where I already posted this EXACT same change..:smile: (see a few posts above yours on this page: http://www.zen-cart.com/showthread.p...69#post1216069)
I also included a detailed explanation for the change..
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
DivaVocals
You apparently missed where I already posted this EXACT same change..:smile: I also included a detailed explanation for the change..
Yep sure did, back to the Jack and tables for me!
Re: Zen Lightbox addon [Support Thread]
Quote:
Originally Posted by
rbarbour
Ultimately ZLB code messed with Zen Stock Code :P
Because the stock code is incorrect to begin with..