Hi, Dave,
There is a short code [pto featured="section"], How and Where to set "section"?
Thanks
Hi David,
I'm having trouble using the PT Featured Products widget to display items in my sidebar. I created the section hotels in my Featured Products and list that in the widget, but nothing shows up. What am I missing?
Hi Brent,
The best way to double check the entries are all correct would be first to use the Featured Products Helper to find the hotels you want to feature; use the button to add the results you want to the Featured Products list, and then add the prefix hotels/ so your resulting Featured Products list would look like:
hotels/Featured Hotel 1
hotels/Featured Hotel 2
Note that an entry of just hotels or hotels/ won't produce any results (so any Featured Products shortcode that called that section would not display anything) however if you did want to display random featured products from a specified category that would be a simple enhancement to the random featured products mod if required...
Cheers,
David.
Hi David,
I'm confused...I do have them set up that way and the section 'hotels' listed in the featured products widget...it works on {link saved}, but not on {link saved}.
Hi Brent,
I just checked the /admin/ Featured Products section of the associated Price Tapestry interface and I see that you've used the section name cayman rather than hotels, so the shortcode usage should be:
[pto featured="cayman"]
Cheers,
David.
yes, i changed it to cayman and made the necessary changes in the shortcode..still not working right on the cayman site....works fine on the other one
Hi Brent,
I just followed by up email; looks like they are being output but some aspect of the HTML being generated / theme HTML is possibly conflicting resulting in the output being shifted off the screen or subsequently hidden...
Cheers,
David.
hi david,
is it possibble to display the last products from a category ?
like
[pto featured="sony" q="3"]
(category:sony | q = last 3 products)
cheers
alecs
Hi Alecs,
Sure - in pto_featured.php look for the following code beginning at line 26:
if ($section)
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($section)."/%' ORDER BY sequence";
}
...and REPLACE with:
if ($section)
{
if (strpos($section,":"))
{
$parts = explode(":",$section);
if (is_numeric($parts[0])) // first n
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($parts[1])."/%' ORDER BY sequence LIMIT ".$parts[0];
}
else // last n
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($parts[0])."/%' ORDER BY sequence DESC LIMIT ".$parts[1];
}
}
else
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($section)."/%' ORDER BY sequence";
}
}
With this in place, to display the first 3 from the "sony" section, use:
[pto featured="3:sony"]
...or to display the last 3 as you want to do in this case:
[pto featured="sony:3"]
Cheers,
David.
--
PriceTapestry.com
mh ... does the admin/Featured Products field needs some aditional informations ?
cheers
alecs
Hi Alecs,
Possibly yes - if you have not set-up Featured Products with sections before; in this case you would use something like:
sony/Product 1
sony/Product 2
sony/Product 3
sony/Product 4
sony/Product 5
sony/Product 6
And then using [pto featured="sony:3"] would display
Product 6 | Product 5 | Product 4
If the reverse order when selecting "last n" is a problem that can be resolved easily, just let me know...
Cheers,
David.
--
PriceTapestry.com
ok... sorry david...
think my request was not properly.
got some cagegories in my merchantfeeds like "Sale" / "Top" / "discount" etc.
i like to display the items from this categorys autmaticaly.
i mean without to select them manually in the feat.product field.
this items have a short livetime, and change daily.
cheers
alecs
Hi Alecs,
One thing to try then, as an alternative to the above replacement; have a go with:
if ($section)
{
if (strpos($section,":"))
{
$parts = explode(":",$section);
if ($parts[0] == "category")
{
$sql = "SELECT name,1 AS sequence FROM `".$pto_config_databaseTablePrefix."products` WHERE category = '".$wpdb->escape($parts[1])."' ORDER BY RAND() LIMIT ".$parts[2];
$section = "";
}
elseif (is_numeric($parts[0])) // first n
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($parts[1])."/%' ORDER BY sequence LIMIT ".$parts[0];
$section = $parts[0];
}
else // last n
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($parts[0])."/%' ORDER BY sequence DESC LIMIT ".$parts[1];
$section = $parts[1];
}
}
else
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($section)."/%' ORDER BY sequence";
}
}
And with that in place you could use [pto featured="category:Sale:3"] and that would show 3 random products from the Sale category...
Cheers,
David.
--
PriceTapestry.com
PERFECT !!!!
this saves me a lot of work !!!
THANKS !
cheers
alecs
Hi David has anything changed with updates since this was posted as I cant seem to get either of the code examples here to return results. Idealy though if it is possible is there a way to pull a set amount of products form specific brands instead of category as described in the last code
Hi there,
Have a go with this simplified version. Revert to the distribution version of pto_featured.php and look for the following code at line 25:
if ($section)
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($section)."/%' ORDER BY sequence";
}
...and REPLACE with:
if ($section)
{
if (strpos($section,":"))
{
$parts = explode(":",$section);
switch($parts[0])
{
case "merchant":case "category":case "brand":
$sql = "SELECT name,1 AS sequence FROM `".$pto_config_databaseTablePrefix."products` WHERE ".$parts[0]." = '".$wpdb->escape($parts[1])."' ORDER BY RAND() LIMIT ".intval($parts[2]);
break;
}
}
else
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."featured` WHERE name LIKE '".$wpdb->escape($section)."/%' ORDER BY sequence";
}
}
Then as your shortcode, use simply:
[pto featured="brand:Brand Name:3"]
...for 3 random featured products from Brand Name. Similar code will also work for Merchant and Category...
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
Hi David,
Where can i find the css for this one?
All images are very big.
Henk
Hello Henk,
The default Featured Products template actually specifies an HTML height attribute (100) on the img element within the Featured Products / Each template (wp-admin > Settings > PriceTapestry.org) and it looks like this is being overridden by your theme CSS, so the best thing to do would be to add a .featured img { } style to wp-content/plugins/pto/resources/pto.css. In that file, you will find the existing class definition beginning at line 35:
.pto_featured img {
margin: 0 0 5px 0;
padding: 0;
}
...so if you REPLACE that with:
.pto_featured img {
margin: 0 0 5px 0;
padding: 0;
height: 100px;
}
...that should prevent any resizing by your theme CSS...
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
I use the one [pto featured="brand:Brand Name:3"] but the prices doesn't show up in the main page its a empty €
http://www.vindgoedkoopste.nl/
Thx
Henk
Hi Henk,
That's strange - in implies that minPrice has not been selected from the database. The placeholders are fine because the currency HTML is displayed - just no actual price.
After making the above modification, the main SELECT sql is constructed at line 74 as follows:
$sql = "SELECT * , MIN( price ) AS minPrice, MAX( price ) AS maxPrice, COUNT( id ) AS numMerchants, ".$sqlCase." FROM `".$pto_config_databaseTablePrefix."products` WHERE name IN (".$sqlIn.") GROUP BY name ORDER BY sequence";
...could you check that you have that line in place, and specifically "MIN( price ) AS minPrice" which is the part that selects the minPrice value and if all looks fine there let me know and i'll investigate further...
Cheers,
David.
--
PriceTapestry.com
I have this line in place, is it maybe the sku?
Thx
Henk
Hi Henk,
Please could you email me your latest pto_featured.php and i'll check that all out for you - at the same time; re: your question on PriceTapestry.com about zero down-time mod; could attach in the same email includes/admin.php and scripts/import.php and I'll check it all out...
Thanks!
David.
--
PriceTapestry.com
Hi,
In your Price Tapestry Administration area, go to the Featured Products administration page, and all you need to do is prefix products with section/ to identify them. For example, if your Featured Products page has something like:
Product 1
Product 2
toys/Product 3
toys/Product 4
garden/Product 5
garden/Product 6
...then if you use the shortcode
[pto featured="garden"]
...then Product 5 and Product 6 will be displayed!
Cheers,
David,