2016-03-31 55 views
-2

這是我的第一篇文章... 我有一個修改過的php文件的問題,但不是從我。 在一個菜單項中我發現這個錯誤: 1054'where子句'中的未知列'Array'SQL = SELECT * FROM #__content WHERE Array ='4' 而在另一個菜單項中,我找到了這個: 警告:無效參數提供的foreach()在... /家庭/模板/ rt_nuance/HTML/com_tags /標籤/上線113'where子句'中的未知列'Array'SQL = SELECT * FROM #__content WHERE Array ='4'

如default.php這是我的PHP文件:

<?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; ?>"> 
 
\t <?php if ($this->params->get('show_page_heading')) : ?> 
 
\t \t <h1> 
 
\t \t \t <?php echo $this->escape($this->params->get('page_heading')); ?> 
 
\t \t </h1> 
 
\t <?php endif; ?> 
 
\t <?php if ($this->params->get('show_tag_title', 1)) : ?> 
 
\t \t <h2> 
 
\t \t \t <?php echo JHtml::_('content.prepare', $this->tags_title, '', 'com_tag.tag'); ?> 
 
\t \t </h2> 
 
\t <?php endif; ?> 
 
\t <?php // We only show a tag description if there is a single tag. ?> 
 
\t <?php if (count($this->item) == 1 && (($this->params->get('tag_list_show_tag_image', 1)) || $this->params->get('tag_list_show_tag_description', 1))) : ?> 
 
\t \t <div class="category-desc"> 
 
\t \t \t <?php $images = json_decode($this->item[0]->images); ?> 
 
\t \t \t <?php if ($this->params->get('tag_list_show_tag_image', 1) == 1 && !empty($images->image_fulltext)) : ?> 
 
\t \t \t \t <img src="<?php echo htmlspecialchars($images->image_fulltext); ?>"> 
 
\t \t \t <?php endif; ?> 
 
\t \t \t <?php if ($this->params->get('tag_list_show_tag_description') == 1 && $this->item[0]->description) : ?> 
 
\t \t \t \t <?php echo JHtml::_('content.prepare', $this->item[0]->description, '', 'com_tags.tag'); ?> 
 
\t \t \t <?php endif; ?> 
 
\t \t \t <div class="clr"></div> 
 
\t \t </div> 
 
\t <?php endif; ?> 
 
\t <?php // If there are multiple tags and a description or image has been supplied use that. ?> 
 
\t <?php if ($this->params->get('tag_list_show_tag_description', 1) || $this->params->get('show_description_image', 1)): ?> 
 
\t \t <?php if ($this->params->get('show_description_image', 1) == 1 && $this->params->get('tag_list_image')) : ?> 
 
\t \t \t <img src="<?php echo $this->params->get('tag_list_image'); ?>"> 
 
\t \t <?php endif; ?> 
 
\t \t <?php if ($this->params->get('tag_list_description', '') > '') : ?> 
 
\t \t \t <?php echo JHtml::_('content.prepare', $this->params->get('tag_list_description'), '', 'com_tags.tag'); ?> 
 
\t \t <?php endif; ?> 
 

 
\t <?php endif; ?> 
 
\t <?php echo $this->loadTemplate('items'); ?> 
 
\t <?php if (($this->params->def('show_pagination', 1) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->get('pages.total') > 1)) : ?> 
 
\t \t <div class="pagination"> 
 
\t \t \t <?php if ($this->params->def('show_pagination_results', 1)) : ?> 
 
\t \t \t \t <p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p> 
 
\t \t \t <?php endif; ?> 
 
\t \t \t <?php echo $this->pagination->getPagesLinks(); ?> 
 
\t \t </div> 
 
\t <?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'] ;?>"> 
 
         </a> 
 

 
         <!-- 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']; ?> 
 
          </a> 
 
         </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']; ?> 
 
           </a> 
 
          </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"> 
 
\t \t \t \t \t   <span itemprop="price" class="text" id="product_price_113"><?php echo $product['price'].' €'; ?></span> 
 
\t \t \t \t    </span> 
 
           <?php if($product['special_price'] > 0): echo '</strike>';?> 
 
            <span class="product-discount-offer" itemprop="offers" itemscope="" itemtype="http://schema.org/Offer"> 
 
\t \t \t \t     <?php echo 'Sconto:'. $product['discount'].' %'; ?> 
 
\t \t \t \t     </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</a> 
 
         </div> 
 
        </form> 
 
       </div><!-- end item --> 
 
      </div> 
 

 
     <?php endforeach; ?> 
 
    </div> 
 

 
</div>

感謝大家...

+0

嘗試提供確切的線路或地方,你得到的問題。人們很難找出這樣的代碼。 –

回答

0

您正在返回它必須是一個字符串,在查詢數組

具體來說,那裏應該有一個列名你得到一個PHP數組。因此,在將數組發送到MySQL之前,PHP會將該數組轉換爲字符串「Array」。

+0

非常感謝您的回答!不幸的是,我不明白這個代碼...我必須做什麼? – Loredana