Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Adding Product Description to Categories Style 3?
- This topic has 9 replies, 2 voices, and was last updated 12 years, 11 months ago by Peter.
-
AuthorPosts
-
November 21, 2011 at 4:50 am #4821LouisMember
Plain and simple, I would like to add the “Product Description” to: [wp_eStore_category_products_fancy id=1 style=3]
Can anyone help me please? So far, I haven’t been lucky.
—
As a side note, just for the sake of socialising and sharing, and this is from personal experience and observation;
I have YET to meet ANYONE, who would click on a “add to cart” button, without entering the product page. Would you?
And this is valid for ANY carts out there. To the point:
A neat solution, would be to have a smooth yet simple optional AJAX popup, showing more important/extra details, and of course, that would make more sense for categories, where you could quickly get the extra information on various products without entering the product page itself.
November 21, 2011 at 6:19 am #38714PeterMemberHi,
Have you tried one of the other styles instead? Eg, Style 5 is similarly compact but also contains product description:
[wp_eStore_category_products_fancy id=1 style=5]
November 21, 2011 at 7:47 am #38715LouisMemberHi Peter,
Thanks for your reply, yes I have noticed Style 5 actually, you are correct it might work, but because I am not good with PHP and CSS it would require extra styling; for instance I don’t want the “Details” showing, and the styling is to the left. Style 3 is kind of great.
So this is what I was trying just now, good timing by the way, I have just read your reply and I was going to post my findings.
This is what I did, I hope that the code won’t be truncated (I analysed style 5 and added to style 3, mind you, I don’t know what I am doing (I added the code in two areas were it shows “//added”) and for the css I just added from Style 5″.eStore-fancy3-description{margin:0px 7px 5px 0px;text-align:justify;overflow:hidden;max-height:115px;}”:
{
global $wpdb;
$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
$ret_product = $wpdb->get_row("SELECT * FROM $products_table_name WHERE id = '$id'", OBJECT);
if($clear)
{
$output .= '<div class="eStore-fancy-clear"></div>';
}
$output .= '<div class="eStore-fancy3">';
$output .= '<div class="eStore-fancy3-thumb">';
$output .= eStore_extra_get_fancy_thumb_code($ret_product);
$output .= '</div>';
//added
$output .='<div class="eStore-fancy3-body">';
$output .='<div class="eStore-fancy3-description">';
//end
$output .='<div class="eStore-fancy3-footer">';
if(!empty($ret_product->product_url))
{
$output .= '<a href="'.$ret_product->product_url.'"><h3>'.$ret_product->name.'</h3></a>';
}
else
{
$output .= '<h3>'.$ret_product->name.'</h3>';
}
//added
$output .= '</div>';
$output .= html_entity_decode($ret_product->description, ENT_COMPAT,"UTF-8");
$output .= '</div>';
//end
if($show_price==1){
$output .= "<br />";
if(!empty($ret_product->old_price)){
$output .= '<div class="eStore_oldprice"><strong>'.ESTORE_OLD_PRICE.': </strong>'.WP_ESTORE_CURRENCY_SYMBOL.$ret_product->old_price.'</div>';
}
$output .= '<div class="eStore-fancy3-price-tag"><strong>'.ESTORE_PRICE.': '.print_digi_cart_payment_currency($ret_product->price, WP_ESTORE_CURRENCY_SYMBOL, ".").'</strong></div>';
}
$output .= eStore_extra_show_button_based_on_condition($id,$ret_product,$button_type,$restriction);
$output .= '</div></div>';
if($clear)
{
$output .= '<div class="eStore-fancy-clear"></div>';
}
return $output;
}As I said, I don’t know what I am doing, wether I missed or messed something up!
November 21, 2011 at 10:29 am #38716LouisMemberActually, because so I am so bad at php and css, I might look into style 5 not lol
November 22, 2011 at 2:55 am #38717LouisMemberTo my good friend Peter,
I tweaked [wp_eStore_category_products_fancy id=1 style=5]
Can you tell me if the following code is ok;
Say if I want to remove the product title, price, add to cart and details buttons.
Basically, I am left with the picture and product description ONLY. Did I do this right?
What does the “200,150” means?
function show_wp_eStore_fancy5($id,$button_type=1,$clear=true,$show_price=1,$restriction='')
{
global $wpdb;
$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
$ret_product = $wpdb->get_row("SELECT * FROM $products_table_name WHERE id = '$id'", OBJECT);
if($clear)
{
$output .= '<div class="eStore-fancy-clear"></div>';
}
$output .= '<div class="eStore-fancy5">';
$output .= '<div class="eStore-fancy5-thumb">';
$output .= eStore_extra_get_fancy_thumb_code($ret_product,200,150);
$output .= '</div>';
$output .='<div class="eStore-fancy5-body">';
$output .='<div class="eStore-fancy5-description">';
$output .='<div class="eStore-fancy5-product-name">';
$output .= '</div>';
$output .= html_entity_decode($ret_product->description, ENT_COMPAT,"UTF-8");
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
return $output;
}For those interested, as you can tell, my requirement for a category fancy style is rather smallish.
November 22, 2011 at 5:47 am #38718PeterMemberHi Louis,
Firstly we don’t recommend messing with the plugin code in general – especially if you’re not comfortable with PHP. Also note that any independent customization which is done by individuals is not supported by us because it makes troubleshooting much more difficult – especially when we have to work with non-standard code.
However having said that, I encourage you to at least save backups of the original files if you are going to experiment with your own customizations.
Before I get to your questions firstly I have a question:
Why do you want to remove the Add to Cart button? How are people going to add the product to your cart? I don’t think removing the buttons is a good idea.
I thought you liked fancy 3 but simply wanted the description added to it.
Now regarding your code:
Firstly since you want fancy 3 PLUS product description you should be modifying the fancy 3 code and not fancy 5.
Also you have to keep in mind that modifications to your php code will also require modifications to the css file, especially if you are adding div tags.
So with reservations, below is an example modification to fancy 3 with the added product description.
Note this is my personal attempt at a suggestion and as mentioned previously this does not mean that we support this customization and as usual you should use it at your own risk.
===========================
This is the code in the shortcode_include.php file
function show_wp_eStore_fancy3($id,$button_type=1,$clear=true,$show_price=1,$restriction=”)
{
global $wpdb;
$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
$ret_product = $wpdb->get_row(“SELECT * FROM $products_table_name WHERE id = ‘$id'”, OBJECT);
if($clear)
{
$output .= ‘<div class=”eStore-fancy-clear”></div>’;
}
$output .= ‘<div class=”eStore-fancy3″>’;
$output .= ‘<div class=”eStore-fancy3-thumb”>’;
$output .='<div class=”eStore-fancy3-footer”>’;
$output .='<div class=”eStore-fancy3-description”>’;
$output .= eStore_extra_get_fancy_thumb_code($ret_product);
$output .= ‘</div>’;
if(!empty($ret_product->product_url))
{
$output .= ‘product_url.'”><i>’.$ret_product->name.'</i>‘;
}
else
{
$output .= ‘<i>’.$ret_product->name.'</i>’;
}
$output .= ”;
$output .= html_entity_decode($ret_product->description, ENT_COMPAT,”UTF-8″);
$output .= ‘</div>’;
if($show_price==1){
$output .= “”;
if(!empty($ret_product->old_price)){
$output .= ‘<div class=”eStore_oldprice”>‘.ESTORE_OLD_PRICE.’: ‘.WP_ESTORE_CURRENCY_SYMBOL.$ret_product->old_price.'</div>’;
}
$output .= ‘<div class=”eStore-fancy3-price-tag”>‘.ESTORE_PRICE.’: ‘.print_digi_cart_payment_currency($ret_product->price, WP_ESTORE_CURRENCY_SYMBOL, “.”).’</div>’;
}
$output .= eStore_extra_show_button_based_on_condition($id,$ret_product,$button_type,$restriction);
$output .= ‘</div></div>’;
if($clear)
{
$output .= ‘<div class=”eStore-fancy-clear”></div>’;
}
return $output;
}
==========================
This what the css code in the file eStore_extra_shortcode_css.css should look like:
/*=== Fancy 3 css ===*/
.eStore-fancy3 {display:block; float:left; padding-right: 25px; padding-bottom:10px; width:150px;}
.eStore-fancy3-thumb img {height: 125px; width: 125px; border: 5px solid #ccc;}
.eStore-fancy3-thumb a img {border: 5px solid #ccc;}
.eStore-fancy3-thumb:hover img {border-color: #333;}
.eStore-fancy3-footer{text-align:center;}
.eStore-fancy3-description{text-align:center;}
.eStore-fancy3-price-tag{font-size: 120%;color: #7A7A7A;}
November 24, 2011 at 4:49 pm #38719LouisMemberHi Peter, just wanna say hi quickly, I haven’t had time to try the above code yet, but will come back soon. Thank you.
December 2, 2011 at 11:27 am #38720LouisMemberHi Peter, I had a quick look, there is an error on this line:
$output .= 'product_url.'"><i>'.$ret_product->name.'</i>';
December 2, 2011 at 11:37 am #38721LouisMemberForgot to answer your question:
“Why do you want to remove the Add to Cart button?
How are people going to add the product to your cart?
I don’t think removing the buttons is a good idea.
I thought you liked fancy 3 but simply wanted the description added to it.”
Removing the cart button was simply for aesthetic reasons and practicality, i.e;
1) in the case where there is a product page, 99% of visitors are more likely to add to cart via the product page.
2) well, to reinforce what I just said above, and to optimise the space, so you can squish a bit more product, by streamlining the interface.
Yes, I liked Fancy 3 because it was the closest to what I wanted, but I found out that it was easier to remove from Fancy 5 (by proceeding by eliminations) than to add to the code in Fancy 3. Yes of course, I did/do backups.
I also notice that the error I pointed out in my previous post, did actually broke the site, so it was a good experience to see the result.
I won’t point the error because it reveals the root.
December 2, 2011 at 11:51 am #38722PeterMemberHi Louis,
Thanks for pointing that out.
I looked at my modified file from where I copied the code from and it correctly displays the missing quotation signs. The html formatting in this forum has somehow screwed up the syntax. (perhaps I should’ve used the ‘code’ tag)
If you want me to send you text file with my original code let me know. I know that it definitely works because i tested it.
-
AuthorPosts
- You must be logged in to reply to this topic.