Version Notes
Improved extension code
Removed option for multiple links to simply process of viewing a product
Started integration of 'View Category' button
Download this release
Release Info
Developer | Magento Core Team |
Extension | Fishpigs_View_Button |
Version | 1.0.0 |
Comparing to | |
See all releases |
Code changes from version 0.7.4 to 1.0.0
- app/code/community/Fishpig/ViewButton/Block/Abstract.php +61 -30
- app/code/community/Fishpig/ViewButton/Block/Catalog/Product.php +39 -139
- app/code/community/Fishpig/ViewButton/etc/config.xml +1 -3
- app/code/community/Fishpig/ViewButton/license.txt +68 -0
- app/code/community/Fishpig/ViewButton/notes.txt +12 -0
- app/design/adminhtml/default/default/layout/view-button.xml +3 -1
- app/design/adminhtml/default/default/template/view-button/button.phtml +26 -0
- app/design/adminhtml/default/default/template/view-button/content.phtml +0 -53
- package.xml +10 -8
app/code/community/Fishpig/ViewButton/Block/Abstract.php
CHANGED
@@ -2,51 +2,82 @@
|
|
2 |
|
3 |
abstract class Fishpig_ViewButton_Block_Abstract extends Mage_Adminhtml_Block_Template
|
4 |
{
|
5 |
-
|
6 |
abstract public function shouldAddButton();
|
7 |
-
abstract public function
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
{
|
11 |
-
|
12 |
-
|
13 |
-
$this->setTemplate('view-button/content.phtml')
|
14 |
-
->setItemType('item');
|
15 |
}
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
18 |
{
|
19 |
-
|
20 |
-
$this->setData('button_id', 'fishpig.view-button');
|
21 |
-
}
|
22 |
-
|
23 |
-
return $this->getData('button_id');
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
public function getButtonHtml()
|
27 |
{
|
28 |
-
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
{
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
|
|
36 |
|
37 |
/**
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
43 |
{
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
-
|
50 |
-
return
|
51 |
-
}
|
52 |
}
|
2 |
|
3 |
abstract class Fishpig_ViewButton_Block_Abstract extends Mage_Adminhtml_Block_Template
|
4 |
{
|
|
|
5 |
abstract public function shouldAddButton();
|
6 |
+
abstract public function getItemType();
|
7 |
+
abstract public function getItemUrl();
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Retrieve the ID for the button
|
11 |
+
*
|
12 |
+
* @return string
|
13 |
+
*/
|
14 |
+
public function getButtonId()
|
15 |
{
|
16 |
+
return 'fishpig.view-button';
|
|
|
|
|
|
|
17 |
}
|
18 |
|
19 |
+
/**
|
20 |
+
* Retrieve the button label
|
21 |
+
*
|
22 |
+
* @return string
|
23 |
+
*/
|
24 |
+
public function getButtonLabel()
|
25 |
{
|
26 |
+
return $this->__('View %s', $this->getItemType());
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
+
/**
|
30 |
+
* Retrieve the HTML for the button
|
31 |
+
*
|
32 |
+
* @return string
|
33 |
+
*/
|
34 |
public function getButtonHtml()
|
35 |
{
|
36 |
+
$buttonHtml = '<button class="scalable form-button" type="button" id="%s"><span>View %s</span></button>';
|
37 |
+
$buttonHtml = '<a href="%s" class="form-button" id="%s" target="_blank" style="margin-left: 5px; padding: 3px 8px 2px; position: relative; text-decoration: none; top: 1px;"><span>%s</span></a>';
|
38 |
+
|
39 |
+
return addslashes(sprintf($buttonHtml, $this->getItemUrl(), $this->getButtonId(), $this->getButtonLabel()));
|
40 |
}
|
41 |
|
42 |
+
/**
|
43 |
+
* Retrieve the most appropriate store
|
44 |
+
* If the admin store is selected, the default store will be returned
|
45 |
+
*
|
46 |
+
* @return Mage_Core_Model_Store
|
47 |
+
*/
|
48 |
+
public function getStore()
|
49 |
{
|
50 |
+
if ($storeId = $this->getRequest()->getParam('store', false)) {
|
51 |
+
$currentStore = Mage::getModel('core/store')->load($storeId);
|
52 |
+
|
53 |
+
if ($currentStore->getCode() != 'admin') {
|
54 |
+
return $currentStore;
|
55 |
+
}
|
56 |
+
}
|
57 |
|
58 |
+
return $this->getPrimaryStore();
|
59 |
+
}
|
60 |
|
61 |
/**
|
62 |
+
* Retrieve the primary store
|
63 |
+
* This can be used for generating item URL's for a specific store
|
64 |
+
*
|
65 |
+
* @return false|Mage_Core_Model_Store
|
66 |
+
*/
|
67 |
+
public function getPrimaryStore()
|
68 |
{
|
69 |
+
if (!$this->hasPrimaryStore()) {
|
70 |
+
$this->setPrimaryStore(false);
|
71 |
+
$websites = Mage::getResourceModel('core/website_collection');
|
72 |
+
|
73 |
+
foreach($websites as $website) {
|
74 |
+
if ($website->getIsDefault()) {
|
75 |
+
$this->setPrimaryStore($website->getDefaultStore());
|
76 |
+
break;
|
77 |
+
}
|
78 |
+
}
|
79 |
}
|
80 |
+
|
81 |
+
return $this->getData('primary_store');
|
82 |
+
}
|
83 |
}
|
app/code/community/Fishpig/ViewButton/Block/Catalog/Product.php
CHANGED
@@ -2,169 +2,69 @@
|
|
2 |
|
3 |
class Fishpig_ViewButton_Block_Catalog_Product extends Fishpig_ViewButton_Block_Abstract
|
4 |
{
|
5 |
-
|
6 |
-
|
7 |
-
public function __construct()
|
8 |
-
{
|
9 |
-
parent::__construct();
|
10 |
-
$this->setItemType('product');
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Determines whether or not to add the View button
|
16 |
-
*
|
17 |
-
* @return bool
|
18 |
-
*/
|
19 |
-
public function shouldAddButton()
|
20 |
-
{
|
21 |
-
return (boolean) $this->getParam('id');
|
22 |
-
}
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Get all the possible URLs for the current product
|
26 |
-
*
|
27 |
-
* @return array
|
28 |
-
*/
|
29 |
-
public function getUrls()
|
30 |
-
{
|
31 |
-
$product = $this->getProduct();
|
32 |
-
|
33 |
-
if ($product instanceof Mage_Catalog_Model_Product) {
|
34 |
-
if ($this->canShow($product)) {
|
35 |
-
if ($this->_includeCategoryUrlKeys()) {
|
36 |
-
if ($categories = $this->_getCategoriesByIds($product->getCategoryIds())) {
|
37 |
-
return $this->_getProductUrls($product, $categories);
|
38 |
-
}
|
39 |
-
}
|
40 |
-
else {
|
41 |
-
return $this->_getProductUrl($product);
|
42 |
-
}
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
return array();
|
47 |
-
}
|
48 |
-
|
49 |
/**
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
public function
|
55 |
-
{
|
56 |
-
//Mage::register('product', Mage::getModel('catalog/product')->load(6));
|
57 |
-
return Mage::registry('product');
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Determine whether or not the product can be shown at all
|
62 |
-
*
|
63 |
-
* @param Mage_Catalog_Model_Product $product
|
64 |
-
* @return bool
|
65 |
-
*/
|
66 |
-
public function canShow(Mage_Catalog_Model_Product $product)
|
67 |
{
|
68 |
-
return
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
{
|
78 |
-
return
|
79 |
}
|
80 |
|
81 |
/**
|
82 |
-
*
|
83 |
*
|
84 |
-
* @
|
85 |
-
* @return null || Mage_Catalog_Model_Mysql_Category_Collection
|
86 |
*/
|
87 |
-
|
88 |
{
|
89 |
-
if (
|
90 |
-
$
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
-
|
95 |
-
return $categories;
|
96 |
}
|
97 |
}
|
98 |
|
99 |
-
return
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
-
|
104 |
-
* It is assumed that the product is a member of all categories in the collection
|
105 |
-
*
|
106 |
-
* @param Mage_Catalog_Model_Product $product
|
107 |
-
* @param $categories
|
108 |
-
* @return array
|
109 |
-
*/
|
110 |
-
protected function _getProductUrls(Mage_Catalog_Model_Product $product, $categories)
|
111 |
-
{
|
112 |
-
$urls = array();
|
113 |
-
|
114 |
-
foreach($categories as $category) {
|
115 |
-
$url = $this->_getProductUrl($product, $category);
|
116 |
-
|
117 |
-
if (!in_array($url, $urls)) {
|
118 |
-
$urls[] = $url;
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
return $urls;
|
123 |
-
}
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Get a product URL
|
127 |
-
* Optional param $category will add the category URL keys onto the URL
|
128 |
*
|
129 |
-
* @
|
130 |
-
* @param mixed $category
|
131 |
-
* @return string;
|
132 |
*/
|
133 |
-
|
134 |
{
|
135 |
-
|
136 |
-
$parts = array($product->getUrlKey());
|
137 |
-
|
138 |
-
while($category->getLevel() >= 2) {
|
139 |
-
$parts[] = $category->getUrlKey();
|
140 |
-
|
141 |
-
if ($category->getParentId()) {
|
142 |
-
$category = $category->getParentCategory();
|
143 |
-
}
|
144 |
-
else {
|
145 |
-
break;
|
146 |
-
}
|
147 |
-
}
|
148 |
-
|
149 |
-
$parts[] = $this->getBaseUrl();
|
150 |
-
|
151 |
-
return implode(DS, array_reverse($parts)).$this->_getProductUrlSuffix();
|
152 |
-
}
|
153 |
-
|
154 |
-
return $this->getBaseUrl() . '/' . $product->getUrlKey().$this->_getProductUrlSuffix();
|
155 |
}
|
156 |
|
157 |
/**
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
163 |
{
|
164 |
-
return
|
|
|
165 |
}
|
166 |
-
|
167 |
-
}
|
168 |
-
|
169 |
-
|
170 |
-
|
2 |
|
3 |
class Fishpig_ViewButton_Block_Catalog_Product extends Fishpig_ViewButton_Block_Abstract
|
4 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
/**
|
6 |
+
* Retrieve the item type (Product)
|
7 |
+
*
|
8 |
+
* @return string
|
9 |
+
*/
|
10 |
+
public function getItemType()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
{
|
12 |
+
return 'Product';
|
13 |
}
|
14 |
|
15 |
/**
|
16 |
+
* Determines whether or not to add the View button
|
17 |
+
*
|
18 |
+
* @return bool
|
19 |
+
*/
|
20 |
+
public function shouldAddButton()
|
21 |
{
|
22 |
+
return $this->getRequest()->getParam('id', false) && $this->getItemUrl();
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
+
* Retrieve the product URL
|
27 |
*
|
28 |
+
* @return array
|
|
|
29 |
*/
|
30 |
+
public function getItemUrl()
|
31 |
{
|
32 |
+
if (!$this->hasItemUrl()) {
|
33 |
+
$this->setItemUrl(false);
|
34 |
+
|
35 |
+
if ($this->getProduct() && $this->canShow($this->getProduct())) {
|
36 |
+
if ($this->getStore()) {
|
37 |
+
$this->getProduct()->setStoreId($this->getStore()->getId());
|
38 |
+
}
|
39 |
+
|
40 |
+
$itemUrl = $this->getProduct()->getProductUrl();
|
41 |
|
42 |
+
$this->setItemUrl($itemUrl);
|
|
|
43 |
}
|
44 |
}
|
45 |
|
46 |
+
return $this->getData('item_url');
|
47 |
}
|
48 |
|
49 |
/**
|
50 |
+
* Retrieve the current product model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
*
|
52 |
+
* @return null || Mage_Catalog_Model_Product
|
|
|
|
|
53 |
*/
|
54 |
+
public function getProduct()
|
55 |
{
|
56 |
+
return Mage::registry('product');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
+
* Determine whether or not the product can be shown at all
|
61 |
+
*
|
62 |
+
* @param Mage_Catalog_Model_Product $product
|
63 |
+
* @return bool
|
64 |
+
*/
|
65 |
+
public function canShow(Mage_Catalog_Model_Product $product)
|
66 |
{
|
67 |
+
return is_object($product) && $product->getId()
|
68 |
+
&& in_array($product->getVisibility(), array(2,4)) && $product->getStatus() == 1;
|
69 |
}
|
70 |
+
}
|
|
|
|
|
|
|
|
app/code/community/Fishpig/ViewButton/etc/config.xml
CHANGED
@@ -2,10 +2,9 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Fishpig_ViewButton>
|
5 |
-
<version>0.
|
6 |
</Fishpig_ViewButton>
|
7 |
</modules>
|
8 |
-
|
9 |
<global>
|
10 |
<blocks>
|
11 |
<viewButton>
|
@@ -13,7 +12,6 @@
|
|
13 |
</viewButton>
|
14 |
</blocks>
|
15 |
</global>
|
16 |
-
|
17 |
<adminhtml>
|
18 |
<layout>
|
19 |
<updates>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Fishpig_ViewButton>
|
5 |
+
<version>1.0.0</version>
|
6 |
</Fishpig_ViewButton>
|
7 |
</modules>
|
|
|
8 |
<global>
|
9 |
<blocks>
|
10 |
<viewButton>
|
12 |
</viewButton>
|
13 |
</blocks>
|
14 |
</global>
|
|
|
15 |
<adminhtml>
|
16 |
<layout>
|
17 |
<updates>
|
app/code/community/Fishpig/ViewButton/license.txt
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fishpig EULA
|
2 |
+
http://fishpig.co.uk
|
3 |
+
|
4 |
+
THIS LICENSE AGREEMENT (HEREINAFTER AGREEMENT) IS AN AGREEMENT BETWEEN YOU (THE
|
5 |
+
PERSON OR COMPANY WHO IS BEING LICENSED TO USE THE SOFTWARE OR DOCUMENTATION)
|
6 |
+
AND AHEADWORKS CO. (HEREINAFTER WE/US/OUR). THE AGREEMENT APPLIES TO ALL
|
7 |
+
PRODUCTS/SOFTWARE/SCRIPTS/SERVICES YOU PURCHASE FROM US.
|
8 |
+
|
9 |
+
1. By using the Software you acknowledge that you have read this Agreement,
|
10 |
+
and that you agree to the content of the Agreement and its terms, and agree
|
11 |
+
to use the Software in compliance with this Agreement.
|
12 |
+
|
13 |
+
2. The Agreement comes into legal force at the moment when you obtain our
|
14 |
+
Software from our site or receive it through email or on data medium at the
|
15 |
+
our discretion or by any other means.
|
16 |
+
|
17 |
+
3. We are the copyright holder of the Software. The Software or a portion of it
|
18 |
+
is a copyrightable matter and is liable to protection by the law. Any
|
19 |
+
activity that infringes terms of this Agreement violates copyright law and
|
20 |
+
will be prosecuted according to the current law. We reserve the right to
|
21 |
+
revoke the license of any user who is holding an invalid license.
|
22 |
+
|
23 |
+
4. This Agreement gives you the right to use the Software on for your own personal
|
24 |
+
or business use, subject to all other terms of this Agreement. Any commercial
|
25 |
+
distribution of the Software without our consent is regarded as violation of this
|
26 |
+
Agreement and entails liability, according to the current law.
|
27 |
+
|
28 |
+
5. You may not use any part of the code in whole or part in any other software.
|
29 |
+
|
30 |
+
6. You may not give, sell, distribute, sub-license, rent, lease or lend any
|
31 |
+
portion of the Software or Documentation to anyone. You may not place the
|
32 |
+
Software on a server so that it is accessible via a public network such as
|
33 |
+
the Internet for distribution purposes.
|
34 |
+
|
35 |
+
7. You are bound to preserve the copyright information intact, this includes the
|
36 |
+
text/link at bottom.
|
37 |
+
|
38 |
+
8. We reserve the right to publish a selected list of users of our Software.
|
39 |
+
|
40 |
+
9. We will not be liable to you for any damages (including any loss of
|
41 |
+
profits/saving, or incidental or consequential) caused to you, your
|
42 |
+
information and your business arising out of the use or inability to use
|
43 |
+
this Software.
|
44 |
+
|
45 |
+
10. We are not liable for prosecution arising from use of the Software against
|
46 |
+
law or for any illegal use.
|
47 |
+
|
48 |
+
11. If you fail to use the Software in accordance with the terms and conditions
|
49 |
+
of this License Agreement, it constitutes a breach of the agreement, and
|
50 |
+
your license to use the program is revoked.
|
51 |
+
|
52 |
+
12. fishpig reserves the right to change this license agreement at any
|
53 |
+
time and impose its clauses at any given time.
|
54 |
+
|
55 |
+
13. License agreement remains effective until terminated. We retain the right to
|
56 |
+
terminate your license to use the Software at any time, if in its sole
|
57 |
+
discretion, you are not abiding by the terms of the Agreement, including,
|
58 |
+
but not limited to, obscuring or removing any link or copyright notice as
|
59 |
+
specified in this agreement. You may terminate it at any time by destroying
|
60 |
+
all copies of the Software. Termination of this Agreement does not bind us
|
61 |
+
to return you the amount spent for purchase of the Software.
|
62 |
+
|
63 |
+
14. If you continue to use the Software after fishpig gives you notice
|
64 |
+
of termination of your license, you hereby agree to accept an injunction to
|
65 |
+
enjoin you from its further use and to pay all costs (including but not
|
66 |
+
limited to reasonable attorney fees) to enforce our revocation of your
|
67 |
+
license and any damages suffered by us because of your misuse of
|
68 |
+
the Software.
|
app/code/community/Fishpig/ViewButton/notes.txt
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
##
|
2 |
+
# Fishpig's View Button
|
3 |
+
#
|
4 |
+
# Author: Benn Tideswell
|
5 |
+
# Email Support: help@fishpig.co.uk
|
6 |
+
# Bug Reports: help@fishpig.co.uk
|
7 |
+
##
|
8 |
+
|
9 |
+
31/07/2011 - v1.0.0
|
10 |
+
- Improved extension code
|
11 |
+
- Removed option for multiple links to simply process of viewing a product
|
12 |
+
- Started integration of 'View Category' button
|
app/design/adminhtml/default/default/layout/view-button.xml
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
|
|
3 |
<adminhtml_catalog_product_edit>
|
4 |
<reference name="content">
|
5 |
-
<block type="viewButton/catalog_product" name="preview_button.catalog.product"/>
|
6 |
</reference>
|
7 |
</adminhtml_catalog_product_edit>
|
|
|
8 |
</layout>
|
1 |
<?xml version="1.0"?>
|
2 |
<layout>
|
3 |
+
|
4 |
<adminhtml_catalog_product_edit>
|
5 |
<reference name="content">
|
6 |
+
<block type="viewButton/catalog_product" after="-" name="preview_button.catalog.product" template="view-button/button.phtml" />
|
7 |
</reference>
|
8 |
</adminhtml_catalog_product_edit>
|
9 |
+
|
10 |
</layout>
|
app/design/adminhtml/default/default/template/view-button/button.phtml
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fishpig
|
4 |
+
*
|
5 |
+
* http://fishpig.co.uk
|
6 |
+
*
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php if ($this->shouldAddButton()): ?>
|
10 |
+
<?php $itemUrl = $this->getItemUrl() ?>
|
11 |
+
<?php if ($itemUrl): ?>
|
12 |
+
<script type="text/javascript">
|
13 |
+
//<![CDATA[
|
14 |
+
document.observe("dom:loaded", function() {
|
15 |
+
try {
|
16 |
+
var backBtn = $$('.content-header .form-buttons button')[0];
|
17 |
+
if (backBtn.id) {
|
18 |
+
backBtn.insert({after : '<?php echo $this->getButtonHtml() ?>'});
|
19 |
+
}
|
20 |
+
}
|
21 |
+
catch (e) {}
|
22 |
+
});
|
23 |
+
//]]>
|
24 |
+
</script>
|
25 |
+
<?php endif; ?>
|
26 |
+
<?php endif; ?>
|
app/design/adminhtml/default/default/template/view-button/content.phtml
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fishpig
|
4 |
-
*
|
5 |
-
* http://fishpig.co.uk
|
6 |
-
*
|
7 |
-
*/
|
8 |
-
?>
|
9 |
-
<?php if ($this->shouldAddButton()): ?>
|
10 |
-
<?php $urls = $this->getUrls() ?>
|
11 |
-
<?php if (count($urls) > 0): ?>
|
12 |
-
<script type="text/javascript">
|
13 |
-
//<![CDATA[
|
14 |
-
document.observe("dom:loaded", function() {
|
15 |
-
var backBtn = $$('.content-header .form-buttons button')[0];
|
16 |
-
if (backBtn.id) {
|
17 |
-
backBtn.insert({after : '<?php echo $this->getButtonHtml() ?>'});
|
18 |
-
|
19 |
-
$('<?php echo $this->getButtonId() ?>').observe('click', function() {
|
20 |
-
$('fish-url-box').show();
|
21 |
-
return false;
|
22 |
-
});
|
23 |
-
|
24 |
-
$('<?php echo $this->getButtonId() ?>_close').observe('click', function () {
|
25 |
-
$('fish-url-box').hide();
|
26 |
-
return false;
|
27 |
-
});
|
28 |
-
}
|
29 |
-
});
|
30 |
-
//]]>
|
31 |
-
</script>
|
32 |
-
<div id="fish-url-box" style="display:none; height:100%; left:0; position:fixed; top: 0; width:100%;">
|
33 |
-
<div class="dimmer" style="background:#000; height:100%; opacity:.4; position:fixed; width:100%; "></div>
|
34 |
-
<div class="entry-edit" style="margin: 100px auto; position:relative; width:720px; z-index:2;">
|
35 |
-
<div class="entry-edit-head">
|
36 |
-
<h4 style="padding-top:4px;">You can view this <?php echo ucwords($this->getItemType()) ?> at any of the following URL's:</h4>
|
37 |
-
<div class="form-buttons">
|
38 |
-
<button type="button" id="<?php echo $this->getButtonId() ?>_close"><span>Close</span></button>
|
39 |
-
</div>
|
40 |
-
</div>
|
41 |
-
<div class="fieldset">
|
42 |
-
<div class="hor-scroll">
|
43 |
-
<ul>
|
44 |
-
<?php foreach($urls as $url): ?>
|
45 |
-
<li><a href="<?php echo $url ?>" target="fish_view"><?php echo $url ?></li>
|
46 |
-
<?php endforeach; ?>
|
47 |
-
</ul>
|
48 |
-
</div>
|
49 |
-
</div>
|
50 |
-
</div>
|
51 |
-
</div>
|
52 |
-
<?php endif; ?>
|
53 |
-
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
package.xml
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fishpigs_View_Button</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license uri="http://
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
<notes>
|
|
|
|
|
12 |
<authors><author><name>fishpig</name><user>auto-converted</user><email>ben@fishpig.co.uk</email></author></authors>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Fishpigs_View_Button</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license uri="http://fishpig.co.uk/license.txt">fishpig EULA</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Add a 'View Product' button to the product edit page in the Magento Admin</summary>
|
10 |
+
<description>Adds a 'View Product' button to the product edit page of the Magento Admin. This makes it easy to edit a product and quickly see the changes on the frontend of your site.</description>
|
11 |
+
<notes>Improved extension code
|
12 |
+
Removed option for multiple links to simply process of viewing a product
|
13 |
+
Started integration of 'View Category' button</notes>
|
14 |
<authors><author><name>fishpig</name><user>auto-converted</user><email>ben@fishpig.co.uk</email></author></authors>
|
15 |
+
<date>2011-07-31</date>
|
16 |
+
<time>11:33:55</time>
|
17 |
+
<contents><target name="magecommunity"><dir name="Fishpig"><dir name="ViewButton"><dir name="Block"><dir name="Catalog"><file name="Product.php" hash="2cbc3346b7a4f5ccfd767df027c84a59"/></dir><file name="Abstract.php" hash="a852114893f97e6861f2246a4e4b1681"/></dir><dir name="etc"><file name="config.xml" hash="f1b0259c41db09846f7461b053f0af18"/></dir><file name="license.txt" hash="257eae92a36bdaaf9584fbf8ba76d1c6"/><file name="notes.txt" hash="db1c5cf0adb92773d308a80f485984e5"/></dir></dir></target><target name="mage"><dir name="app"><dir name="etc"><dir name="modules"><file name="Fishpig_ViewButton.xml" hash="86ae20de7366760ce6e0944aae29100a"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="view-button.xml" hash="4cb0d860fd3a2d65b27c7b57513a4284"/></dir><dir name="template"><dir name="view-button"><file name="button.phtml" hash="d0dbc7a65811b9bd9dfe69311eeafb9c"/></dir></dir></dir></dir></dir></target></contents>
|
18 |
<compatible/>
|
19 |
<dependencies/>
|
20 |
</package>
|