I have some feeds (that I want to show using featuredproducts.php) which has products that are only valid on a specific weekday. The problem is that the feed stays on the network. So the products still show on the other weekdays while not valid anymore.
How can I work with that? I put categories on the frontpage (by featuredproducts.php) so maybe a specific category can only be shown on that weekday? Or is there some cronjob that can be made to de-import the feed?
Hi,
I have a featuredproducts.php to show several categories on the frontpage.
Let's suppose I want to add a category to the current categories called "Monday" that should only show on Monday.
How would that work with the following code?
{code saved}
Hi Marco,
No changes at all required to your featuredproducts.php code - with a Monday/ category created, all you need is the code from above within your index.php at the location required to dynamically call featuredproducts.php with $featuredproducts_category = "Monday"; only on Monday...
$day = date("l");
if ($day == "Monday")
{
$featuredproducts_category = "Monday";
require("featuredproducts.php");
}
Cheers,
David.
--
PriceTapestry.com
I tried it but the index.php doesn't show the category with date.
I have this in my index.php:
<?php
require("includes/common.php");
require("html/header.php");
require("html/searchform.php");
// print javascript_focus("search.q");
$featuredproducts_categoryRandom = "category top";
require("featuredproducts.php");
$day = date("5");
if ($day == "Friday")
{
$featuredproducts_categoryRandom = "Category Friday";
require("featuredproducts.php");
}
require("html/footer.php");
?>
Hi Marco,
Make sure that $featuredproducts_categoryRandom isn't also set (line 6 in your code) - that should be all it is. I assume that you have in your Featured Products entries such as
Category Friday/Product 1
Category Friday/Product 2
Category Friday/Product 3
Cheers,
David.
--
PriceTapestry.com
Sorry David, I think I didn't give you enough information before.
I'm not listing featured product names, but specific categories without specifying the products in the category. I have several categories and added merchants to those categories (exclusively). You made a special mod for this and send it to me by email on February 28 (email title: pricetapestry.com/node/3243).
I'm not sure what to do with date code in combination with that mod?
Hi Marco,
In that case using $featuredproducts_categoryRandom is correct, but I just noticed that the date() line is incorrect. To test for the Friday category, use:
$day = date("l",6);
...and then once it's working, remove the time value, using just:
$day = date("l");
...which will return the current day.
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi Marco,
Can you confirm that
search.php?category:Category+Friday
(where Category+Friday is exactly what you are using in $featuredproducts_categoryRandom with + in place of spaces)
does return results?
Cheers,
David.
--
PriceTapestry.com
It doesn't return with results. I tried some other categories but they don't have results too.
Hi Marco,
Does the category index show your Friday Category? If you're still not sure, could you email me a link to your site, any password required for /admin/ and your latest index.php and featuredproducts.php and I'll check it out for you...
Cheers,
David.
--
PriceTapestry.com
Hi Marco,
Sure - it sounds like you're using the Featured Product category mod, so how about creating a section using the day of the week required, e.g.
Monday/Product 1
Monday/Product 2
etc.
Then, that section can only be called in on Monday using PHP's date() function - try something like this:
$day = date("l");
if ($day == "Monday")
{
$featuredproducts_category = "Monday";
require("featuredproducts.php");
}
Cheers,
David.
--
PriceTapestry.com