Salve a tutti!
Ho un problema con un file che è stato modificato e dopo l'aggiornamento a joomla 3.5.0 non funziona più.
Parto dall'inizio... il sito è un e-commerce e il cliente aveva bisogno che determinati articoli finissero in due diverse voce di menù (ad esempio sia in abbigliamento donna che in outlet) ma questo non era possibile con il componente per e-commerce che avevamo scelto così è stato modificato il componente tag così che dando un determinato tag (nello specifico "outlet") a quell'articolo questo finisse anche nella voce di menù outlet (creata come "elementi taggati").
Per far sì che questa voce di menù fosse un elenco di prodotti "comprabili" è stato modificato il file default.php della cartella com_tags. Dopo l'aggiornamento Joomla però la pagina "outlet" mi restituisce un errore:
1054 Unknown column 'Array' in 'where clause' SQL=SELECT * FROM #__content WHERE Array = '4'
Mentre l'altra pagina creata con lo stesso principio dei tag mi dice:
Warning: Invalid argument supplied for foreach() in .../home/templates/rt_nuance/html/com_tags/tag/default.php on line 113
Faccio copia-incolla del file in oggetto, grazie in anticipo a chi vorrà darmi una mano:
<?php
/**
* @package Joomla.Site
* @subpackage com_tags
*
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
// Note that there are certain parts of this layout used only when there is exactly one tag.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
$isSingleTag = (count($this->item) == 1);
?>
<div class="tag-category<?php echo $this->pageclass_sfx; ?>">
<?php if ($this->params->get('show_page_heading')) : ?>
<h1>
<?php echo $this->escape($this->params->get('page_heading')); ?>
</h1>
<?php endif; ?>
<?php if ($this->params->get('show_tag_title', 1)) : ?>
<h2>
<?php echo JHtml::_('content.prepare', $this->tags_title, '', 'com_tag.tag'); ?>
</h2>
<?php endif; ?>
<?php // We only show a tag description if there is a single tag. ?>
<?php if (count($this->item) == 1 && (($this->params->get('tag_list_show_tag_image', 1)) || $this->params->get('tag_list_show_tag_description', 1))) : ?>
<div class="category-desc">
<?php $images = json_decode($this->item[0]->images); ?>
<?php if ($this->params->get('tag_list_show_tag_image', 1) == 1 && !empty($images->image_fulltext)) : ?>
<img src="<?php echo htmlspecialchars($images->image_fulltext); ?>">
<?php endif; ?>
<?php if ($this->params->get('tag_list_show_tag_description') == 1 && $this->item[0]->description) : ?>
<?php echo JHtml::_('content.prepare', $this->item[0]->description, '', 'com_tags.tag'); ?>
<?php endif; ?>
<div class="clr"></div>
</div>
<?php endif; ?>
<?php // If there are multiple tags and a description or image has been supplied use that. ?>
<?php if ($this->params->get('tag_list_show_tag_description', 1) || $this->params->get('show_description_image', 1)): ?>
<?php if ($this->params->get('show_description_image', 1) == 1 && $this->params->get('tag_list_image')) : ?>
<img src="<?php echo $this->params->get('tag_list_image'); ?>">
<?php endif; ?>
<?php if ($this->params->get('tag_list_description', '') > '') : ?>
<?php echo JHtml::_('content.prepare', $this->params->get('tag_list_description'), '', 'com_tags.tag'); ?>
<?php endif; ?>
<?php endif; ?>
<?php echo $this->loadTemplate('items'); ?>
<?php if (($this->params->def('show_pagination', 1) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->get('pages.total') > 1)) : ?>
<div class="pagination">
<?php if ($this->params->def('show_pagination_results', 1)) : ?>
<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p>
<?php endif; ?>
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php
jimport('joomla.application.component.controller');
$app = JFactory::getApplication();
//j3 compatibility
if(!defined('DS')){
define('DS',DIRECTORY_SEPARATOR);
}
JLoader::register('J2StoreController', JPATH_COMPONENT.'/controllers/controller.php');
JLoader::register('J2StoreModel', JPATH_ADMINISTRATOR.'/components/com_j2store/models/model.php');
JLoader::register('J2StoreView', JPATH_ADMINISTRATOR.'/components/com_j2store/views/view.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/library/base.php');
require_once (JPATH_SITE.'/components/com_j2store/helpers/utilities.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/library/prices.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/helpers/strapper.php');
require_once (JPATH_ADMINISTRATOR.'/components/com_j2store/version.php');
require_once (JPATH_SITE.'/components/com_j2store/models/products.php');
J2StoreStrapper::addJS();
J2StoreStrapper::addCSS();
$tes_prod = new J2StoreModelProducts();
$tes_prod->setId('118');
$test_item = $tes_prod->getItem();
$test_data = J2StoreHelperCart::getItemInfo('118');;
?>
<h1 style="color#f00">TAG</h1>
<link href="<?php echo JURI::base().'media/j2store/css/j2store-product.css' ?>" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/3.1.8/imagesloaded.pkgd.js"></script>
<style>
.sm-row-fluid :nth-child(3n+4){margin-left:0; clear: both; }
.sm-row-fluid + table{display:none;}
.j2store-item-title-link {display:block;}
</style>
<div class="row-fluid sm-row-fluid">
<?php foreach( $this->items as $value):
$this_prod_obj = new J2StoreModelProducts();
$this_prod_obj->setId($value->content_item_id);
$item = $this_prod_obj->getItem();
$product = array(
'id' => $value->content_item_id,
'name' => $item->product_name,
'main_image' => $item->main_image ,
'price' => number_format ( $item->item_price, 2 ),
'special_price' => number_format ( $item->special_price, 2 ),
'discount' => number_format ( 100-($item->special_price*100/$item->item_price), 0 ),
'url' => JURI::base().'outfit/view/'.$value->content_item_id.'-'.$item->product_name
);
?>
<div class="span4 sm-product-box" >
<div class="j2store-product-single j2store-product-single-113 column-1" itemscope="" itemtype="http://schema.org/Product">
<!-- on Before display product -->
<div class="j2store-before-display-product">
</div>
<!-- Form action starts here -->
<form action="/carrello" method="post" name="j2storeProductForm" id="j2store-product-list" class="j2storeProductForm">
<!-- Before displaying product Images -->
<div class="j2store-before-display-productimages">
</div>
<a itemprop="url" class="j2store-item-title-link" href="<?php echo $product['url'] ?>">
<img class="j2store-item-productlist-thumbimage" itemprop="image" src="<?php echo $product['main_image'] ?>" alt="<?php echo $product['name'] ;?>">
[/url]
<!-- Title -->
<h3 class="j2store-item-title" itemprop="name">
<a itemprop="url" class="j2store-item-title-link" href="<?php echo $product['url'] ?>">
<?php echo $product['name']; ?>
[/url]
</h3>
<div class="sm-product-hoover" style="position: absolute; top:0; left: 0; bottom: 0; right: 0; width: 100%; height:100%; display: none;">
<!-- Title -->
<h1 class="j2store-item-title" itemprop="name">
<a itemprop="url" class="j2store-item-title-link" href="<?php echo $product['url'] ?>">
<?php echo $product['name']; ?>
[/url]
</h1>
<div class="j2store-product-prices">
<span class="j2store-product-item-label">Prezzo</span>
<?php if($product['special_price'] > 0) echo '<strike>';?>
<span itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span itemprop="price" class="text" id="product_price_113"><?php echo $product['price'].' €'; ?></span>
</span>
<?php if($product['special_price'] > 0): echo '</strike>';?>
<span class="product-discount-offer" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<?php echo 'Sconto:'. $product['discount'].' %'; ?>
</span>
<span itemprop="offers" itemscope="" itemtype="http://schema.org/Offer">
<span itemprop="price" id="product_special_price_113" class="product-special-price"><?php echo $product['special_price'].' €'; ?></span>
</span>
<?php endif; ?>
</div>
<a id="addtoCartBtn" href="<?php echo $product['url'] ?>" type="submit" class="j2store-item-cart-button button " value="Aggiungi al carrello">Aggiungi al carrello[/url]
</div>
</form>
</div><!-- end item -->
</div>
<?php endforeach; ?>
</div>
</div>