Commit 7d101b51 authored by zucha.imz's avatar zucha.imz

RC1

parent c53212d7
; @copyright Copyright (c) 2018 PhCProduct. All rights reserved.
; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
PLG_CONTENT_PHOCACARTPRODUCT="content - PhCProduct PhocaCartProduct"
; @copyright Copyright (c) 2018 PhCProduct. All rights reserved.
; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
PLG_CONTENT_PHOCACARTPRODUCT="content - PhCProduct PhocaCartProduct"
PLG_CONTENT_PHOCACARTPRODUCT_FILTER_FEATURED="Featured only"
PLG_CONTENT_PHOCACARTPRODUCT_SHOW_DESC="Show item description"
PLG_CONTENT_PHOCACARTPRODUCT_SHOW_DETAIL_BTN="Show detail button"
......@@ -52,7 +52,8 @@ class plgcontentPhocaCartProduct extends JPlugin {
{
return true;
}
$p['display_view_product_button'] = $this->params->get( 'display_view_product_button', 1 );
$p['display_product_description'] = $this->params->get( 'display_product_description', 0 );
$output = $row->text;
$regex = "#{phocacartproduct}(.*?){/phocacartproduct}#s";
$found = preg_match_all($regex, $output, $matches);
......@@ -65,9 +66,13 @@ class plgcontentPhocaCartProduct extends JPlugin {
$map = $value;
$map = str_replace('{phocacartproduct}', '', $map);
$map = str_replace('{/phocacartproduct}', '', $map);
$find = '|';
$product_id = explode($find, $map);
$html = $this->_render_product($product_id);
$findparam = '|';
$itparams = explode($findparam, $map);
$find = ';';
$product_id = explode($find, $itparams[0]);
if(isset($itparams[1])) $p['display_view_product_button'] = $itparams[1];
if(isset($itparams[2])) $p['display_product_description'] = $itparams[2];
$html = $this->_render_product($product_id,$p['display_product_description'],$p['display_view_product_button']);
$row->text = str_replace($value,$html,$row->text);
}
}
......@@ -77,12 +82,12 @@ class plgcontentPhocaCartProduct extends JPlugin {
}
function _render_product(array $product_id) {
function _render_product(array $product_id, $showdesc, $showdetailbtn) {
$t['pathitem'] = PhocacartPath::getPath('productimage');
$layoutV = new JLayoutFile('button_product_view', null, array('component' => 'com_phocacart'));
$layoutP = new JLayoutFile('product_price', null, array('component' => 'com_phocacart'));
$p['display_view_product_button'] = 1;
$p['display_product_description'] = 1;
$p['display_view_product_button'] = $showdetailbtn;
$p['display_product_description'] = $showdesc;
$html = '<div class="ph-product-module-box'.$moduleclass_sfx .'">';
if(sizeof($product_id)>1) $cols = (100-sizeof($product_id)*5)/sizeof($product_id);
else $cols = 100;
......@@ -92,7 +97,7 @@ class plgcontentPhocaCartProduct extends JPlugin {
if (!empty($product_id)) {
foreach ($product_id as $k => $pid) {
$v = PhocacartProduct::getProduct($pid);
$v = PhocacartProduct::getProduct($pid,0,0);
$html .= '<div class="ph-item-box">'; //style="width:auto; display:flex; margin-left:'.sizeof($product_id).'px
//$html .= $pid;
$html .= '<div class="thumbnail ph-thumbnail">';
......
......@@ -16,8 +16,17 @@
<version>0.9.0</version>
<description>
<![CDATA[
Add Phoca Cart product to article <b>{phocacartproduct}product_id{/phocacartproduct}</b> <i>//Example: {phocacartproduct}1{/phocacartproduct}</i><br/>
Add multipe products to article <b>{phocacartproduct}1|2{/phocacartproduct}</b> <i>// Delimiter is "|" </i>
<h3>Phoca Cart product plugin</h3>
<p>This plugin allow display one or more product from PhocaCart in article</p>
<h4>How to use the plugin </h4>
<p>Insert this code to any position in article, and will be replaced by phoca cart product.
<code><b>{phocacartproduct}</b>product_id1;product_id2|display_view_product_button|display_product_description<b>{/phocacartproduct}</b></code></p>
<h5>Examples</h5>
<p><i>{phocacartproduct}1{/phocacartproduct}</i> - display product with id 1<br/>
<p><i>{phocacartproduct}1;3;7{/phocacartproduct}</i> - display products with ids 1,3 and 7<br/>
<p><i>{phocacartproduct}5|1{/phocacartproduct}</i> - display product with id 5 and display VIEW PRODUCT BUTTON<br/>
<p><i>{phocacartproduct}4;7|0|1{/phocacartproduct}</i>- display products with ids 4 and 7. Hide VIEW PRODUCT BUTTON and show PRODUCTS DESCRIPTION<br/>
</p>
]]>
</description>
......@@ -33,9 +42,27 @@
<config>
<fields name="params">
<fieldset name="basic">
<field name="display_product_description" type="radio"
default="0"
description="PLG_CONTENT_PHOCACARTPRODUCT_SHOW_DESC_D"
label="PLG_CONTENT_PHOCACARTPRODUCT_SHOW_DESC"
>
<option value="0">JOFF</option>
<option value="1">JON</option>
</field>
<field name="display_view_product_button" type="radio"
default="0"
description="PLG_CONTENT_PHOCACARTPRODUCT_SHOW_DETAIL_BTN_D"
label="PLG_CONTENT_PHOCACARTPRODUCT_SHOW_DETAIL_BTN"
>
<option value="0">JOFF</option>
<option value="1">JON</option>
</field>
</fieldset>
</fields>
</config>
</extension>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment