Forums / Upgrading to 1.5.x / Updating Mod for 150 - Little Problem

Updating Mod for 150 - Little Problem

Views: 7,490

Results 41 to 60 of 62
3 Apr 2012, 1:10 PM
#41
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Updating Mod for 150 - Little Problem

DivaVocals:

Thank nigel and Glenn.. I'm just the backup singer in this group..:laugh::laugh: Just call me one of the Pips!!

on the midnight train to Georgia - whoo hoo

LOL sing it girl!

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

3 Apr 2012, 1:13 PM
#42
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Updating Mod for 150 - Little Problem

ScriptJunkie:

LOL sing it girl!:laugh::laugh::laugh:

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

11 Apr 2012, 5:43 AM
#43
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

Ok, this worked fine on my test site, but installing it into a 150 live store gives me this error:

PHP Parse error: syntax error, unexpected '}' in includes/modules/recent_products.php on line 20

Suggestions?

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 5:53 AM
#44
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Updating Mod for 150 - Little Problem

ScriptJunkie:

Ok, this worked fine on my test site, but installing it into a 150 live store gives me this error:

Suggestions?Compare the includes/modules/recent_products.php files in your test and live store.. is the line where you get the error in your live store different?? and I don't use the line number as it's line 20 in the live store.. that same line might be a different line number in the test store..

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

11 Apr 2012, 3:07 PM
#45
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

DivaVocals:

Compare the includes/modules/recent_products.php files in your test and live store.. is the line where you get the error in your live store different?? and I don't use the line number as it's line 20 in the live store.. that same line might be a different line number in the test store..

Unable to compare. I uninstalled the mod from my test store once testing was completed.

During the initial install on the live store, filezilla kept timing out and disconnecting. So this morning, I did a complete uninstall, reinstall of the mod in case any files were corrupted the first time around.

Same results. The code in includes/modules/recent_products.php, lines 17-21 is below. I don't know a lot about php code...but I don't see what's wrong with it.

if (RECENT_VIEWED_PRODUCTS_MAXIMUM < 1) 
	//set the maximum number of recently viewed products here
	 $maximum_recent = 5;
	 } else {
	 $maximum_recent = RECENT_VIEWED_PRODUCTS_MAXIMUM;

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 3:10 PM
#46
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Updating Mod for 150 - Little Problem

You're missing the { that should follow the if test: ```php
if (RECENT_VIEWED_PRODUCTS_MAXIMUM < 1) {
//set the maximum number of recently viewed products here
$maximum_recent = 5;
} else {
$maximum_recent = RECENT_VIEWED_PRODUCTS_MAXIMUM;

11 Apr 2012, 3:40 PM
#47
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Updating Mod for 150 - Little Problem

gjh42:

You're missing the { that should follow the if test: ```php
if (RECENT_VIEWED_PRODUCTS_MAXIMUM < 1) {
//set the maximum number of recently viewed products here
$maximum_recent = 5;
} else {
$maximum_recent = RECENT_VIEWED_PRODUCTS_MAXIMUM;

Ahhhhhhhhhhhhhhh.. this totally explains the error.. since the error says that a closing bracket was found when there was no opening one.. 


Scriptjunkie, if you have a program like Developer's Notepad, it might have been able to help you spot this since it colors the code, and you can usually spot invalid stuff (like missing opening brackets..) because it would be colored differently.. Hard to explain this really.. If you use this program you will see what I mean.. Great for novices like myself to troubleshoot stuff with.

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

11 Apr 2012, 4:11 PM
#48
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

gjh42:

You're missing the { that should follow the if test: ```php
if (RECENT_VIEWED_PRODUCTS_MAXIMUM < 1) {
//set the maximum number of recently viewed products here
$maximum_recent = 5;
} else {
$maximum_recent = RECENT_VIEWED_PRODUCTS_MAXIMUM;


Thanks Glenn!  I'll get that fixed and upload a corrected fileset to the downloads section.

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 4:14 PM
#49
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

DivaVocals:

Ahhhhhhhhhhhhhhh.. this totally explains the error.. since the error says that a closing bracket was found when there was no opening one..

Scriptjunkie, if you have a program like Developer's Notepad, it might have been able to help you spot this since it colors the code, and you can usually spot invalid stuff (like missing opening brackets..) because it would be colored differently.. Hard to explain this really.. If you use this program you will see what I mean.. Great for novices like myself to troubleshoot stuff with.

I use Notepad++ and it does indeed color the code....but I haven't been using it long enough to know what the color coding is telling me. LOL maybe I should read the help file <grin>

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 4:48 PM
#50
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

Hmmm....ok...now I'm getting these errors:

PHP Warning: require(includes/templates/template_default/templates/tpl_modules_recent_products.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory in /includes/templates/custom/templates/tpl_product_info_display.php on line 302and

PHP Fatal error: require() [<a href='function.require'>function.require</a>]: Failed opening required 'includes/templates/template_default/templates/tpl_modules_recent_products.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /includes/templates/custom/templates/tpl_product_info_display.php on line 302This is the code on line 302 of tpl_product_info_display.php:

<!--bof recent products module-->
   <?php require($template->get_template_dir ('tpl_modules_recent_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates') . '/tpl_modules_recent_products.php'); ?>
   <!--eof recent products module-->

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 4:55 PM
#51
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Updating Mod for 150 - Little Problem

Does this file exist??
includes/templates/template_default/templates/tpl_modules_recent_products.php

If I am reading this correctly, the error says that this file cannot be found at that location..

ScriptJunkie:

Hmmm....ok...now I'm getting these errors:

and

This is the code on line 302 of tpl_product_info_display.php:

<!--bof recent products module--> <?php require($template->get_template_dir ('tpl_modules_recent_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates') . '/tpl_modules_recent_products.php'); ?> <!--eof recent products module-->

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

11 Apr 2012, 6:13 PM
#52
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

DivaVocals:

Does this file exist??
includes/templates/template_default/templates/tpl_modules_recent_products.php

If I am reading this correctly, the error says that this file cannot be found at that location..

That's kind of what I thought it was saying also...but then I thought...why would it say that? This is an addon file that would go in custom templates (vs a core file that the addon modified).

So no, it doesn't exist because when I installed, I installed it into my custom template folder, per the folder structure in the addon's fileset.

It seems strange to me that an addon would be written to look in template_default rather than in custom_template. But that does appear to be what the error is indicating. A simple and obvious fix is to simply load that file into template_default, but I think the better thing to do is to make sure the code is properly written because putting an addon file in template_default instead of custom_template is incorrect procedure unless you want the addon to work in ALL templates vs. your chosen template.

However....this was not an issue in the vanilla install. It's only happening in my customized store. Not sure what's causing this issue.

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 6:48 PM
#53
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Updating Mod for 150 - Little Problem

ScriptJunkie:

That's kind of what I thought it was saying also...but then I thought...why would it say that? This is an addon file that would go in custom templates (vs a core file that the addon modified).

So no, it doesn't exist because when I installed, I installed it into my custom template folder, per the folder structure in the addon's fileset.

It seems strange to me that an addon would be written to look in template_default rather than in custom_template. But that does appear to be what the error is indicating. A simple and obvious fix is to simply load that file into template_default, but I think the better thing to do is to make sure the code is properly written because putting an addon file in template_default instead of custom_template is incorrect procedure unless you want the addon to work in ALL templates vs. your chosen template.

However....this was not an issue in the vanilla install. It's only happening in my customized store. Not sure what's causing this issue.
First thing to do IMHO is to add the file to the default_template folder and see if the error goes away..

I do not think it's an issue for this file to be in the default_template folder.. It's not a core file and will not be overwritten in an upgrade because of this. (which is the primary purpose of the override system)

However, I'll leave it to those more knowledgeable than I to weigh in here..:smile:

My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

11 Apr 2012, 6:54 PM
#54
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

DivaVocals:

First thing to do IMHO is to add the file to the default_template folder and see if the error goes away..

I do not think it's an issue for this file to be in the default_template folder.. It's not a core file and will not be overwritten in an upgrade because of this. (which is the primary purpose of the override system)

However, I'll leave it to those more knowledgeable than I to weigh in here..:smile:

OMG :blush: I had the same thought as you, but before I did it, I checked the custom template folder and the file in question simply wasn't there - that's what was causing the error. I have no idea how that happened because I specifically remember uploading that file along with my customized tpl_product_info_display.php file.

So I uploaded it, and now I get this error:

PHP Parse error: syntax error, unexpected T_ELSE in /includes/modules/recent_products.php on line 57

The code for that file, lines 52 - 58 is

$num_products_count = ($recent_products_query == '') ? 0 : $recent_products->RecordCount();
  // show only when 1 or more
 if ($num_products_count > 0) 
  if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS == 0) 
    $col_width = floor(100/$num_products_count);
  } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS);

I just don't understand why these legitimate code errors didn't show up during testing on a vanilla install. If the code is wrong - it's wrong - regardless of which template is being used.

Is that right?

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 6:58 PM
#55
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Updating Mod for 150 - Little Problem

Yes, the code you quoted is wrong ... regardless of what template is being used.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Apr 2012, 6:58 PM
#56
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

Wondering if I need a bracket after this line:

if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS == 0) 
  $col_width = floor(100/$num_products_count); 

so that it looks like this:

$num_products_count = ($recent_products_query == '') ? 0 : $recent_products->RecordCount();
  // show only when 1 or more
 if ($num_products_count > 0) 
  if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS == 0) 
    $col_width = floor(100/$num_products_count); {
  } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS);  
``` 

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 7:22 PM
#57
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

that didn't work.

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

11 Apr 2012, 7:39 PM
#58
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Updating Mod for 150 - Little Problem

The semicolon is closing the two IF statements.

If you want to nest IF statements, and incorporate ELSE statements also, then you'd be better off using full brace structure.

if (condition) 
{
  if (condition) 
  {
    statement;
  } else {
    statement;
  }
}

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Apr 2012, 7:51 PM
#59
scriptjunkie avatar

scriptjunkie

Totally Zenned

Join Date:
Jul 2008
Posts:
772
Plugin Contributions:
0

Re: Updating Mod for 150 - Little Problem

DrByte:

The semicolon is closing the two IF statements.

If you want to nest IF statements, and incorporate ELSE statements also, then you'd be better off using full brace structure.

if (condition)
{
if (condition)
{
statement;
} else {
statement;
}
}



Ahhh ok...so this:

```php
$num_products_count = ($recent_products_query == '') ? 0 : $recent_products->RecordCount();
  // show only when 1 or more
 if ($num_products_count > 0) 
  if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS == 0) 
    $col_width = floor(100/$num_products_count);
  } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS);
```becomes this?

```php
$num_products_count = ($recent_products_query == '') ? 0 : $recent_products->RecordCount();
  // show only when 1 or more
  if ($num_products_count > 0)
{  
  if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS == 0)
{  
    $col_width = floor(100/$num_products_count);
  } else {
    $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_RECENT_PRODUCTS);
 }
} 

**Edit: ** Ok, I tried the above but I must have done something wrong, because I'm still getting this error:

PHP Parse error: syntax error, unexpected T_ELSE in /includes/modules/recent_products.php on line 57

*Go that extra mile, you never know what's at the end of the road

* Empowerment Sanctuary

13 Apr 2012, 11:27 PM
#60
nigelt74 avatar

nigelt74

Totally Zenned

Join Date:
Sep 2005
Location:
Waikato, New Zealand
Posts:
1,558
Plugin Contributions:
1

Re: Updating Mod for 150 - Little Problem

Hi I have just checked the beta i attached a few posts back and the missing brace is there in the beta, i am guessing that perhaps you may have accidentally removed it, whilst getting rid of my commented out testing code
This is my "cleaned" version, which hasn't yet been tested, but should be fine as only the extraneous comments have been removed

ScriptJunkie:

Unable to compare. I uninstalled the mod from my test store once testing was completed.

During the initial install on the live store, filezilla kept timing out and disconnecting. So this morning, I did a complete uninstall, reinstall of the mod in case any files were corrupted the first time around.

Same results. The code in includes/modules/recent_products.php, lines 17-21 is below. I don't know a lot about php code...but I don't see what's wrong with it.

if (RECENT_VIEWED_PRODUCTS_MAXIMUM < 1)
//set the maximum number of recently viewed products here
$maximum_recent = 5;
} else {
$maximum_recent = RECENT_VIEWED_PRODUCTS_MAXIMUM;

Webzings Design
Semi retired from Web Design