Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Default Specials Page

Default Specials Page

Views: 6,216

Results 1 to 20 of 22
22 Dec 2006, 2:44 PM
#1
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Default Specials Page

With the way v1.3.6 is setup, one cannot have a blank Specials page.

Note: status is auto enabled/disabled when dates are set

Tried using EZ pages -- didn't work -- and editting the 'if >0' statements in the "tpl_specials_default.php" but could not get an 'else' statement to echo some text.

Is there a way or setting, to always enable a blank or default Specials page?

The learning is in the doing.

Potent Products

23 Dec 2006, 4:02 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Default Specials Page

Not enough coffee yet ...

What is a "blank" Special to you?

Specials can have:

1 beginning date

2 ending date

3 beginning and ending date

4 no dates

What is missing for your needs?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

23 Dec 2006, 4:33 PM
#3
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

I don't know if this is what he's talking about, but this is the issue I'm having...

I've hard coded a link to the specials page.

If there are no specials defined, you get just a blank specials page, instead a "Specials" heading and of some sort of "there are no specials at this time" text.

http://www.tlc.jadetrue.com/specials.html

23 Dec 2006, 5:01 PM
#4
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,650
Plugin Contributions:
0

Re: Default Specials Page

The page is designed to just disappear if you have no specials defined.

Jade, in your case you would need to have a conditional statement to say- sorry there are no specials at the moment. Refer to the product listing, it has a "sorry there are no products in this category".

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

23 Dec 2006, 9:18 PM
#5
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

I've made my own solution to this. There's probably a better way to code it, but I'm a php hacker, not an expert. :sleepy: Rob, I hope this was your original issue, otherwise I've terribly hijacked your thread.

There are three files that need adjustments:

includes/modules/pages/specials/main_template_vars.php (there's no override here, you're modifying a core file)
includes/templates/YOUR_TEMPLATE/templates/tpl_specials_default.php
includes/languages/YOUR_TEMPLATE/english.php

Step 1. open includes/modules/pages/specials/main_template_vars.php

Find:

  $num_products_count = $specials->RecordCount();
  if ($num_products_count) {
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
      $col_width = floor(100/$num_products_count);
    } else {
      $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }

Replace with:

  $num_products_count = $specials->RecordCount();
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 and $num_products_count!=0) {
      $col_width = floor(100/$num_products_count);
    } else {
	  if ($num_products_count ==0) {
	     $col_width = 0;
		 } else {
      $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }
}

Step 2. open up includes/templates/YOUR_TEMPLATE/templates/tpl_specials_default.php

Find:

<h1 id="specialsListingHeading"><?php echo $breadcrumb->last(); ?></h1>

Add this after:

<?php if ($num_products_count ==0) {
 echo TEXT_NO_SPECIALS; }?>

**Step 3. **You need to add a define for the above code. Open up includes/languages/YOUR_TEMPLATE/english.php

Add this somewhere, changing the text to your preference:

define('TEXT_NO_SPECIALS', 'There are currently no specials. Please check back later.');
23 Dec 2006, 9:19 PM
#6
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

Kim:

The page is designed to just disappear if you have no specials defined.

Jade, in your case you would need to have a conditional statement to say- sorry there are no specials at the moment. Refer to the product listing, it has a "sorry there are no products in this category".

Kim, this page shows up in the site map for 1.3.6, without code to make it disappear if there are no specials defined.

25 Dec 2006, 2:57 AM
#7
website_rob avatar

website_rob

Inactive

Join Date:
Oct 2006
Location:
Alberta, Canada
Posts:
4,572
Plugin Contributions:
0

Re: Default Specials Page

Thank you, Jade.

You were right on target and your modification works quite nicely.

One minor slip-up though.

Replace with:
$num_products_count = $specials->RecordCount();
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 and $num_products_count!=0) {
$col_width = floor(100/$num_products_count);
} else {
if ($num_products_count ==0) {
$col_width = 0;
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
}
}

That last bracket was not required for it to work for me -- v1.3.6.

The learning is in the doing.

Potent Products

14 Jan 2007, 4:23 PM
#8
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

Website Rob:

Thank you, Jade.

You were right on target and your modification works quite nicely.

One minor slip-up though.

That last bracket was not required for it to work for me -- v1.3.6.

Thanks Rob, you are correct.

The replacement code for step 1 should be:

$num_products_count = $specials->RecordCount();
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 and $num_products_count!=0) {
$col_width = floor(100/$num_products_count);
} else {
if ($num_products_count ==0) {
$col_width = 0;
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
}
10 Oct 2007, 3:56 PM
#9
nrg77 avatar

nrg77

Zen Follower

Join Date:
May 2007
Posts:
181
Plugin Contributions:
0

Re: Default Specials Page

For me, this doesn't fully work if anyone can help...

When there are no specials set, the message does come up however, when I do have a specials set, the product doesn't show. It does show in the sideboxes but nothing in the main content just as if no specials are set.

Can anyone shed some light on this?

10 Oct 2007, 9:29 PM
#10
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

nrg77:

For me, this doesn't fully work if anyone can help...

When there are no specials set, the message does come up however, when I do have a specials set, the product doesn't show. It does show in the sideboxes but nothing in the main content just as if no specials are set.

Can anyone shed some light on this?

Did you see the correction to the code one step above?

10 Oct 2007, 9:42 PM
#11
nrg77 avatar

nrg77

Zen Follower

Join Date:
May 2007
Posts:
181
Plugin Contributions:
0

Re: Default Specials Page

jettrue:

Did you see the correction to the code one step above?

Yes I did....Please note that it is not giving me any syntax error or any error. It just doesn't show the products. But I know it is enabled since the specials do show in the sideboxes....

10 Oct 2007, 10:00 PM
#12
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

nrg77:

Yes I did....Please note that it is not giving me any syntax error or any error. It just doesn't show the products. But I know it is enabled since the specials do show in the sideboxes....

Ok, I think I remember having this issue too!

instead of Step 1. I listed, do the below.

In the original file of includes/modules/pages/specials/main_template_vars.php, replace this:

  $num_products_count = $specials->RecordCount();
  if ($num_products_count) {
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
      $col_width = floor(100/$num_products_count);
    } else {
      $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }

with this:

 $num_products_count = $specials->RecordCount();
 
  if ($num_products_count ==0) {
	$col_width=0;
  } else {
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
      $col_width = floor(100/$num_products_count);
    } else {
      $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }
  }
11 Oct 2007, 5:35 AM
#13
nrg77 avatar

nrg77

Zen Follower

Join Date:
May 2007
Posts:
181
Plugin Contributions:
0

Re: Default Specials Page

jettrue:

Ok, I think I remember having this issue too!

instead of Step 1. I listed, do the below.

In the original file of includes/modules/pages/specials/main_template_vars.php, replace this:

$num_products_count = $specials->RecordCount();
if ($num_products_count) {
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
$col_width = floor(100/$num_products_count);
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
}

>  
>  
> with this:
>  
> ```
 $num_products_count = $specials->RecordCount();
 
  if ($num_products_count ==0) {
    $col_width=0;
  } else {
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
      $col_width = floor(100/$num_products_count);
    } else {
      $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }
  }

Now I get the opposite effect. The specials now show up but when I disable the specials, I don't get any text message anymore....

11 Oct 2007, 9:55 PM
#14
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

nrg77:

Now I get the opposite effect. The specials now show up but when I disable the specials, I don't get any text message anymore....

Third times a charm (hopefully)... try this chunk instead:

 $num_products_count = $specials->RecordCount();
 
  if ($num_products_count ==0) {
	$col_width=0;
  } else {
    if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
      $col_width = floor(100/$num_products_count);
    } else {
      $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
    }
  }
11 Oct 2007, 10:22 PM
#15
nrg77 avatar

nrg77

Zen Follower

Join Date:
May 2007
Posts:
181
Plugin Contributions:
0

Re: Default Specials Page

jettrue:

Third times a charm (hopefully)... try this chunk instead:

$num_products_count = $specials->RecordCount();

if ($num_products_count ==0) {
$col_width=0;
} else {
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS==0 ) {
$col_width = floor(100/$num_products_count);
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS);
}
}

 
 
Still no text.....weird....
12 Oct 2007, 2:43 AM
#17
nrg77 avatar

nrg77

Zen Follower

Join Date:
May 2007
Posts:
181
Plugin Contributions:
0

Re: Default Specials Page

jettrue:

That's working on my test sites... you made the other changes (step 2 and 3) from the first page of this thread right?

Yes, I made all the changes.

12 Oct 2007, 2:45 AM
#18
jettrue avatar

jettrue

Totally Zenned

Join Date:
Jan 2005
Location:
USA, St. Louis
Posts:
3,651
Plugin Contributions:
5

Re: Default Specials Page

nrg77:

Yes, I made all the changes.

Then I'm not sure what else to advise, except to check and double check its all been uploaded, the changes are made in the right template folder, etc.

12 Oct 2007, 2:53 AM
#19
nrg77 avatar

nrg77

Zen Follower

Join Date:
May 2007
Posts:
181
Plugin Contributions:
0

Re: Default Specials Page

jettrue:

Then I'm not sure what else to advise, except to check and double check its all been uploaded, the changes are made in the right template folder, etc.

The one thing I did noticed though is that you have equal amount of opening and closing braces in your code snippet. When I go to paste your exact code into the file, it won't work as it "claims" to have one too many so I had to delete one from yours.

That suggests to me that something is wrong or it already is missing one brace....However, why didn't it throw a syntax error....

If that was the case, it effects many others, not just me....

12 Oct 2007, 2:56 AM
#20
nrg77 avatar

nrg77

Zen Follower

Join Date:
May 2007
Posts:
181
Plugin Contributions:
0

Re: Default Specials Page

To add to what I just said, I refer back to the post where that person also experienced what I experienced as well. So I started counting the braces and yours is correct 4 open 4 close. So he too deleted one from yours thinking you put one too many but that is not the case...