-
Notifications
You must be signed in to change notification settings - Fork 5
old Readme.md
The Productivity extension contains different features which make life of store administrator easier. It includes fast cross-switching between products, categories, CMS pages and respective editors, basic editing of product and its images, uploading new images to product in the frontend.
The extension doesn't require any initial configuration. The toolbar is displayed on the front end for all authorised users.
Users logged in as an admin to the same domain as the frontend gets access to all productivity features.
Logged in customers that a members of a customer group Reviewer
have access to all productivity features, except those that link directly to the backend.
- Create a customer group called
Reviewer
- Assign a customer to this group
- Log in as that customer via the front end to see the productivity toolbar
More configuration options are available in ... tab under System/Configuration menu.
If the extension is installed, you are logged in as an admin and the toolbar is not displayed you may check for:
- Check that the extension is properly installed in Magento Connect
- Check if there is mVentory group of tabs with Productivity tab under System / Configuration.
- Javascript errors in the browser console
- Check the HTML source for presence of productivity CSS/JS files (view page source, Ctrl+F, type in productivity in the search box)
The panel is shown on Category, Product and CMS pages in the front end. It contains various buttons such as:
- Button for fast editing pages in the admin. It opens a corresponding page in the admin if the user is logged in as an admin to the same domain.
- Button for basic editing of product in the front-end
- Button for uploading new images for product
- Button for fast opening analytics page
- Help button
Pop-up panel which is shown when the mouse pointer is over product image. It allows to delete, rotate and make main images.
The editor is enabled by default but only configured for the default theme. Custom themes with modified HTML layout or sizes of product images require additional configuration.
The editor is configured via theme's layout files such as local.xml. Place following code in that file to adjust it for the custom theme:
<catalog_product_view>
<reference name="productivity.image.edit">
<action method="setTemplate">
<template>custom/template_for/image_edit.phtml</template>
</action>
<action method="setImageWrapperSelector">
<selector><![CDATA[#product_addtocart_form .product-image]]></selector>
</action>
<action method="setImageSelector">
<selector><![CDATA[img]]></selector>
</action>
<action method="setThumbWrapperSelector">
<selector><![CDATA[#product_addtocart_form .more-views li]]></selector>
</action>
<action method="setThumbSelector">
<selector><![CDATA[a img]]></selector>
</action>
<action method="setImageSize">
<width>265</width>
<height></height>
</action>
<action method="setThumbSize">
<width>56</width>
<height></height>
</action>
</reference>
</catalog_product_view>
Allow to import content (content:encoded tag) of first item from feed. Add 'productivity/rss_import' block to the layout in necessary place to show content of the item.
Using example:
<reference name="insert_to_block">
<block type="productivity/rss_import" name="productivity.rss.import" after="some_block" before="some_black">
<!-- Set url to feed -->
<action method="setUri"><uri>http://foo.bar/feed/</uri></action>
<!-- Set value of ID attribute -->
<action method="setElementId"><id>my-unique-id</id></action>
<!-- Add additional CSS classes -->
<action method="setAdditionalClass"><class>my-class another-class</class></action>
<!-- Set cache lifetime in seconds or ... -->
<action method="setCacheLifetime"><period>3600</period></action>
<!-- ... Disable caching -->
<action method="unsCacheLifetime" />
</block>
</reference>
- "View in frontend" button appears on Product, Category and other admin pages above the main block of buttons to quickly jump from the admin to the front end page
Adds button for preview product, category and cms page
- Added in adminhtml's productivity.xml:
THERE IS CODE HERE BUT GITHUB SWALLOWS IT - LOOK IN SOURCE
<adminhtml_catalog_product_edit> productivity.css </adminhtml_catalog_product_edit> <adminhtml_catalog_category_edit> productivity.css </adminhtml_catalog_category_edit> <adminhtml_cms_page_edit> productivity.css </adminhtml_cms_page_edit>
Adds middle click for Attributes Adds middle click for Attribute Sets
- Done by js code in update_grid.js file which is appended to the page in adminhtml's productivity.xml:
<adminhtml_catalog_product_attribute_index> <script>productivity/adminhtml/update_grid.js</script> productivity.css </adminhtml_catalog_product_attribute_index> <adminhtml_catalog_product_set_index> <script>productivity/adminhtml/update_grid.js</script> </adminhtml_catalog_product_set_index>
Adds middle click for attributes in editing attribute set
- Done by js code in script.js.phtml file which is appended to the page in adminhtml's productivity.xml:
<adminhtml_catalog_product_set_edit> </adminhtml_catalog_product_set_edit>
You can request some magento data in a form of an rss feed. Currently we have only 2 feeds:
1. List of products per category.
Meaning of the parameters:
- rss - Needs to be set to "1" to make the server return the feed instead of the regular list of products
- thumbnail_size - Size of thumbnail images returned in the feed. This needs to comply with our list of available dimensions (see mventory/Product Images CDN/Resizing Dimensions)
- fullimage_size - Works the same way as "thumbnail_size" but sets the dimensions of full size images in the feed.
Please note that if thumbnail_size and/or fullimage_size are not specified they will be set to hardcoded default values:
- "thumbnail_size" default value: "215x170"
- "fullimage_size" default value: "300x300"
It's possible to return same data as in RSS feed but in simple JSONP format. Add json=1
and callback=name_of_function
into the URL to get JS code with data.
Data format:
[
{
"title": "Name of product",
"description": "Description of product",
"url": "Product URL",
"image": "URL for product's main image",
"price": "Price of product"
},
"..."
]
Note: data in JSON format is passed as parameter of the callback function for cross-domain data exchange
2. List of top categories per store.
Example url: http://offsider.co.nz/index.php/catalog/category/top
3. List of latest products per store.
Exaample URL: http://offsider.co.nz/productivity/rss_product/latest/
Widget type: productivity/slideshow
This widget is available in CMS pages to output a list with product info for inclusion in a slideshow. Wrap the widget into arbitrary HTML, add scripts via the layout XML and the page gets a slideshow of your choosing without digging into magento code.
Params:
-
products_count
- how many products to return in the list -
item_template
- escaped HTML with variables -
image_size
- from the list of available sizes and no resizing is done
Variables:
-
%url%
- absolute URL of the product -
%img%
- absolute URL of the product image -
%name%
- product name -
%description%
- product description -
%price%
- product price -
%price-block%
- block with product price as it's showed in category view -
%add-to-cart-url%
- absolute URL for adding product to cart -
%if:sale% .. <content> .. %end:sale%
- shows its content if product has sale price at the moment
As of now it outputs a random list of products in stock.
{{widget type="productivity/slideshow" products_count="40" item_template="<li>
<a href=\"%url%\">
<img src=\"%img%\" alt=\"%name% %price%\"/>
</a>
%if:sale%<span>(Sale!)</span>%end:sale%
</li>" image_size="215x170"}}
*Content: *
<div id="ri-grid" class="ri-grid ri-shadow">{{widget type="productivity/slideshow" products_count="40" item_template="<li><a href=\"%url%\"><img src=\"%img%\" alt=\"%name% %price%\"/></a></li>" image_size="215x170"}}</div>
<script type="text/javascript">// <![CDATA[
jQuery(function ($) {
$('#ri-grid').gridrotator();
});
// ]]></script>
Layout XML:
<reference name="head">
<action method="addItem"><type>js_css</type><name>gridrotator/gridrotator.css</name></action>
<action method="addJs"><script>gridrotator/jquery-gridrotator.js</script></action>
</reference>
Widget type: productivity/widget_latest
This widget is available in CMS pages to output a list with product info for inclusion in a slideshow. Wrap the widget into arbitrary HTML, add scripts via the layout XML and the page gets a slideshow of your choosing without digging into magento code.
Parameters:
-
products_count
- how many products to return in the list -
item_template
- escaped HTML with variables -
image_size
- from the list of available sizes and no resizing is done
Template variables:
-
%url%
- absolute URL of the product -
%img%
- absolute URL of the product image -
%name%
- product name -
%description%
- product description -
%price%
- product price -
%price-block%
- block with product price as it's showed in category view -
%add-to-cart-url%
- absolute URL for adding product to cart -
%if:sale% .. <content> .. %end:sale%
- shows its content if product has sale price at the moment
{{widget type="productivity/slideshow" products_count="40" item_template="<li>
<a href=\"%url%\">
<img src=\"%img%\" alt=\"%name% %price%\"/>
</a>
%if:sale%<span>(Sale!)</span>%end:sale%
</li>" image_size="215x170"}}
Content:
<div id="ri-grid" class="ri-grid ri-shadow">{{widget type="productivity/slideshow" products_count="40" item_template="<li><a href=\"%url%\"><img src=\"%img%\" alt=\"%name% %price%\"/></a></li>" image_size="215x170"}}</div>
<script type="text/javascript">// <![CDATA[
jQuery(function ($) {
$('#ri-grid').gridrotator();
});
// ]]></script>
Layout XML:
<reference name="head">
<action method="addItem"><type>js_css</type><name>gridrotator/gridrotator.css</name></action>
<action method="addJs"><script>gridrotator/jquery-gridrotator.js</script></action>
</reference>
Widget type: productivity/widget_attribute
This widget is available in CMS pages to output a list with attribute values for inclusion in a slideshow. Wrap the widget into arbitrary HTML, add scripts via the layout XML and the page gets a slideshow of your choosing without digging into magento code.
Params:
-
item_template
- escaped HTML with variables -
code
- attribute's code
Variables:
-
%code%
- attribute's code -
%label%
- label of attribute's value -
%value%
- id of attribute's value
{{widget type="productivity/widget_attribute" item_template="<li>%code%: %label% (%value%)</li>" code="brands"}}
*Content: *
{{widget type="productivity/widget_attribute" item_template="<a href=\"/fashion/clothing.html?%code%=%value%\">%label%</a> " code="cloth_brand_"}}
Block type: productivity/product_related
This block is used to show related products based on a shared attribute and its value in the current product. It can be used only on a product details page.
The block returns a list of all products that have a matching value of the same attribute regardless on the attribute set or category. E.g. there are cups, mugs and plates who share attribute color
. If the product details page displays a purple
mug then the related products will have other purple
mugs, cups and plates.
Params:
-
attribute_code
- attribute's code -
product_count
- number of products to show
<block type="productivity/product_related" name="product.info.related" as="related_products" template="catalog/product/list/related.phtml">
<action method="setAttributeCode">
<attribute_code>color</attribute_code>
</action>
<action method="setProductsCount">
<products_count>5</products_count>
</action>
</block>
Layout file (for example local.xml):
<block type="productivity/product_related" name="product.info.related" as="related_products" template="catalog/product/list/related.phtml">
<action method="setAttributeCode">
<attribute_code>color</attribute_code>
</action>
<action method="setProductsCount">
<products_count>5</products_count>
</action>
</block>
Basic template which can be used in the block:
<?php $_products = $this->getProductCollection(); ?>
<?php if ($_products->getSize()): ?>
<?php
$_helper = $this->helper('catalog/output');
$_imageHelper = $this->helper('catalog/image');
$_addToCartText = $this->__('Buy now');
?>
<ul>
<?php foreach ($_products as $_product): ?>
<?php
$_name = $_helper->productAttribute($_product, $_product->getName(), 'name');
$_productUrl = $_product->getProductUrl();
?>
<li>
<a href="<?php echo $_productUrl; ?>" title="<?php echo $_name; ?>">
<img src="<?php echo $_imageHelper->init($_product, 'small_image')->resize(170); ?>" width="170" alt="<?php echo $this->htmlEscape($this->getImageLabel($_product, 'small_image')); ?>" />
</a>
<h2 class="product-name"><?php echo $_name; ?></h2>
<?php echo $this->getPriceHtml($_product, true); ?>
<button type="button" title="<?php echo $_addToCartText; ?>" class="button btn-cart" onclick="setLocation('<?php echo $_productUrl; ?>')">
<span>
<span><?php echo $_addToCartText; ?></span>
</span>
</button>
</li>
<?php endforeach ?>
</ul>
<?php endif; ?>
Inserting block as a child in some template to output related products (for example catalog/product/view.php):
<?php echo $this->getChildHtml('related_products'); ?>