Jump to content

 

preudomme

Member Since 03 Mar 2009
Offline Last Active Mar 11 2022 01:07 PM
-----

#184944 Add-On Request: Trays Planner

Posted by preudomme on 03 June 2014 - 12:44 PM

Hi everyone,

I need a custom add-on for cs-cart v4. I'm selling special food display trays that are used in fridge counters in supermarkets, restaurants, etc.

The addon will be a visual designer that the customer can use to plan the layout of the trays in the fridge and add them to cart.

The basic functions will be:

1. The user should be able to draw the basic fridge (with a top view basic look) on a grid space.
2. User can also select some pre-defined fridge dimensions from a list and the fridge 2d top view drawing appears on the grid.
3. User choses the trays from a trays library and places them on the fridge plan by drag-drop. These trays are also defined as individual products or product options (there are 4-5 types of trays with different dimensions) in the store.
4. When the user choses "Done. Add the trays to the cart", the addon adds all the selected trays in the cart

That's it.

Waiting for your replies.


Cheers


#177448 Addon: Cs-Cart Seo Optimization, Canonical Url, Seo History - Cdseo

Posted by preudomme on 14 February 2014 - 07:27 AM

Thanks to Thomas for the great support and fast fix.
Updated version solves my problem.


#158434 Add Google Structured Data (formerly Rich Snippets) to your product pages

Posted by preudomme on 21 March 2013 - 08:57 PM

Thank you all for trying out.

I posted this mod but then as I don't like core files modifications, I studied a little bit and figured out how to apply this mod with the lovely hooks and by the help of my_changes add-on.

Here is how it is

1. Create func.php in /addons/my_changes and paste this function in the file

<?php
if ( !defined('AREA') ) { die('Access denied'); }
/* FUNCTION REVIEW COUNT -- START */
function fn_my_changes_get_review_count($object_id,$object_type)
{
			global $db_tables;
			
			$discussion = fn_get_discussion($object_id, $object_type);
			
			if (empty($discussion)) {
				return false;
			}
			return db_get_field("SELECT COUNT(b.post_id) as val FROM ?:discussion_rating as a LEFT JOIN ?:discussion_posts as b ON a.post_id = b.post_id WHERE a.thread_id = ?i and b.status = 'A'", $discussion['thread_id']);						
}
/* FUNCTION - REVIEW COUNT -- END */
?>

2. Create /hooks directory (if not exists) in /skins/YOUR_SKIN/customer/addons/my_changes

3. Check the hook name used in your product details .tpl file. For "default_template.tpl" the hook is defined as:
{hook name="products:view_main_info"}

So our folder structure should be like this /skins/YOUR_SKIN/customer/addons/my_changes/hooks/products

4. Inside this folder create a file named "view_main_info.post.tpl" . We will add the rich snippets code after the "products:view_main_info" hook

5. Copy the following code in view_main_info.post.tpl

{** Rich Snippets - Product Schema - START **}
{*HTML microdata*}
{assign var="product_amountN" value=$product.inventory_amount|default:$product.amount}
{assign var="url" value="`$config.current_location`/`$config.current_url`"|fn_url}
{assign var="average_rating" value=$product.product_id|fn_get_average_rating:"P"}
{assign var="rev_count" value=$product.product_id|fn_my_changes_get_review_count:"P"}

<div style="display: none;" itemscope itemtype="http://schema.org/Product">
<span itemprop="name">{$product.product|unescape}</span>
	 <span itemprop="image">{$config.current_location}{$product.main_pair.detailed.image_path}</span>
  <img itemprop="image" src="{$config.current_location}{$product.main_pair.detailed.http_image_path}"/>
	 <span itemprop="description"> {$product.full_description}</span>
	 <span itemprop="url">{$url}</span>
	 <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
  <span itemprop="price">{$product.price|format_price:$currencies.$primary_currency:''}</span>
   <meta itemprop="priceCurrency" content="TRY" />
   {if $product_amountN > 0}
		  <link itemprop="availability" href="http://schema.org/InStock">
   {else}
	<link itemprop="availability" href="http://schema.org/OutOfStock">
   {/if}
  </span>
  <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
   <span itemprop="ratingValue">{$average_rating}</span>
	  <span itemprop="bestRating">5</span>
   <span itemprop="reviewCount">{$rev_count}</span>
	</div>
</div>
{** Rich Snippets - Product Schema - END **}

That's it. By using the hooks and my_changes technique it's possible to do anything without altering any core files.

Again don't forget to change YOUR_SKIN and currency code "TRY" to your desired values.

Cheers...


#158195 Free Social Analytics Plugin by AddShoppers

Posted by preudomme on 19 March 2013 - 09:12 PM

Thank you UniDevelopers, you have made my point as much clear as possible. I see that this change has already been applied by AddShoppers and now TL sign is ok.

I also have one more comment on the review/rating stars shown at the popup window. It seems that those stars only display ratings as integer values. If the product has an average rating of 3.5/5, while the cs-cart stars shows the rating correctly as 3.5 stars (also Google), the AddShoppers popup displays this as 3 stars.

I really appreciate AddShoppers for their fast responses to comments and feature requests


#158062 Add Google Structured Data (formerly Rich Snippets) to your product pages

Posted by preudomme on 18 March 2013 - 10:57 PM

* Updated to hooks & my_changes version. Check post #5 *

It's fairly easy actually

This is my case with v3.0.6, should be ok for v3.x.x and also should be ok for v2.x.x with maybe minor changes regarding the template file and what variables are used for pulled data, depending on your cart version.

This MOD includes one additional function.

1. Open /addons/discussions/controllers/customer/init.post.php

Add this function at the end of the file:

function fn_get_review_count($object_id,$object_type)
{
			global $db_tables;
			
			$discussion = fn_get_discussion($object_id, $object_type);
			
			if (empty($discussion)) {
				return false;
			}
			return db_get_field("SELECT COUNT(b.post_id) as val FROM ?:discussion_rating as a LEFT JOIN ?:discussion_posts as b ON a.post_id = b.post_id WHERE a.thread_id = ?i and b.status = 'A'", $discussion['thread_id']);						
}

2. Open up your product template .tpl file i.e:
/skins/YOUR_SKIN/customer/blocks/product_templates/default_template.tpl (may be different in your case)

Add this code right at the end of the file:

{assign var="product_amountN" value=$product.inventory_amount|default:$product.amount}
{assign var="url" value="`$config.current_location`/`$config.current_url`"|fn_url}
{assign var="average_rating" value=$product.product_id|fn_get_average_rating:"P"}
{assign var="rev_count" value=$product.product_id|fn_get_review_count:"P"}

<div style="display: none;" itemscope itemtype="http://schema.org/Product">
<span itemprop="name">{$product.product|unescape}</span>
	 <span itemprop="image">{$config.current_location}{$product.main_pair.detailed.image_path}</span>
  <img itemprop="image" src="{$config.current_location}{$product.main_pair.detailed.http_image_path}"/>
	 <span itemprop="description"> {$product.full_description}</span>
	 <span itemprop="url">{$url}</span>
	 <span itemprop="offers" itemscope itemtype="http://schema.org/Offer">
  <span itemprop="price">{$product.price|format_price:$currencies.$primary_currency:''}</span>
   <meta itemprop="priceCurrency" content="YOUR_CURRENCY_CODE" />
   {if $product_amountN > 0}
		  <link itemprop="availability" href="http://schema.org/InStock">
   {else}
		  <link itemprop="availability" href="http://schema.org/OutOfStock">
   {/if}
  </span>
  <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
   <span itemprop="ratingValue">{$average_rating}</span>
	  <span itemprop="bestRating">5</span>
   <span itemprop="reviewCount">{$rev_count}</span>
	</div>
</div>

That's it!

Don't forget to change "YOUR_CURRENCY_CODE" (without the quotes) to your currency (EUR, USD etc)

You can check if it works for you from the google test page at: http://www.google.co...ls/richsnippets

Enjoy...