Новости Joomla

0 Пользователей и 1 Гость просматривают эту тему.
  • 19 Ответов
  • 12919 Просмотров
*

dim66

  • Осваиваюсь на форуме
  • 49
  • 4 / 0
Стандартно, при просмотре категории, товары выводятся списком (рисунок, название, цена, кнопка подробнее).
Хочу добавить кнопку "купить", чтобы можно было сделать покупку не заходя в карточку товара.

Ясно, что нужно редактировать файл components/com_virtuemart/views/category/tmpl/default.php

код, отвечающий за создание и работу кнопки "добавить в корзину" в карточке товара такой:


Спойлер
[свернуть]


Но после вставки кода кнопка появляется, но не работает.....кто подскажет?
« Последнее редактирование: 15.11.2013, 21:51:16 от fsv »
*

dim66

  • Осваиваюсь на форуме
  • 49
  • 4 / 0
В общем разобрался с помощью пользователя Xander с forum.virtuemart.ru спасибо ему :)
Код из первого топика верный, единственное надо было в нем заменить вместо $this->product->product_name должно быть $product->product_name, вместо $this->product->virtuemart_product_id необходимо $product->virtuemart_product_id

Удачи
*

Ragivort

  • Завсегдатай
  • 1154
  • 58 / 2
  • Такая Life
А почему не добавляются дополнительные поля? Настраиваемые которые?
Дозволь мне свершить то добро, которое я способен свершить, теперь, ибо я могу более не вернуться сюда.
*

Ragivort

  • Завсегдатай
  • 1154
  • 58 / 2
  • Такая Life
Разобрался. Везде нужно вместо $this->product-> просто $product->
Дозволь мне свершить то добро, которое я способен свершить, теперь, ибо я могу более не вернуться сюда.
*

vitalyx

  • Захожу иногда
  • 99
  • 14 / 0
от себя добавлю, что сам код(готовый) вставлять не везде получается, выдает различные ошибки, от ошибки типа

        Error the quantity of the product for calculation is 0, please notify the shopowner, the product id 0

до не добавления в корзину и не работающих кнопок + -, как пример можно вставить после этих строк
Код
// Do we need to close the current row now?
   if ($iBrowseCol == $BrowseProducts_per_row || $iBrowseProduct == $BrowseTotalProducts) {?>
   <div class="clear"></div>
   </div> <!-- end of row -->
« Последнее редактирование: 26.03.2012, 23:10:30 от vitalyx »
*

vitalyx

  • Захожу иногда
  • 99
  • 14 / 0
вот готовый вариант шаблона категории
Код
<?php
/**
*
* Show the products in a category
*
* @package VirtueMart
* @subpackage
* @author RolandD
* @author Max Milbers
* @todo add pagination
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: default.php 5692 2012-03-20 20:30:08Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
JHTML::_( 'behavior.modal' );
/* javascript for list Slide
  Only here for the order list
  can be changed by the template maker
*/
$js = "
jQuery(document).ready(function () {
jQuery('.orderlistcontainer').hover(
function() { jQuery(this).find('.orderlist').stop().show()},
function() { jQuery(this).find('.orderlist').stop().hide()}
)
});
";

$document = JFactory::getDocument();
$document->addScriptDeclaration($js);

/*$edit_link = '';
if(!class_exists('Permissions')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'permissions.php');
if (Permissions::getInstance()->check("admin,storeadmin")) {
$edit_link = '<a href="'.JURI::root().'index.php?option=com_virtuemart&tmpl=component&view=category&task=edit&virtuemart_category_id='.$this->category->virtuemart_category_id.'">
'.JHTML::_('image', 'images/M_images/edit.png', JText::_('COM_VIRTUEMART_PRODUCT_FORM_EDIT_PRODUCT'), array('width' => 16, 'height' => 16, 'border' => 0)).'</a>';
}

echo $edit_link; */ ?>
<div class="category_description">
<?php echo $this->category->category_description ; ?>
</div>
<?php
/* Show child categories */

if ( VmConfig::get('showCategory',1) ) {
if ($this->category->haschildren) {

// Category and Columns Counter
$iCol = 1;
$iCategory = 1;

// Calculating Categories Per Row
$categories_per_row = VmConfig::get ( 'categories_per_row', 3 );
$category_cellwidth = ' width'.floor ( 100 / $categories_per_row );

// Separator
$verticalseparator = " vertical-separator";
?>

<div class="category-view">

<?php // Start the Output
if(!empty($this->category->children)){
foreach ( $this->category->children as $category ) {

// Show the horizontal seperator
if ($iCol == 1 && $iCategory > $categories_per_row) { ?>
<div class="horizontal-separator"></div>
<?php }

// this is an indicator wether a row needs to be opened or not
if ($iCol == 1) { ?>
<div class="row">
<?php }

// Show the vertical seperator
if ($iCategory == $categories_per_row or $iCategory % $categories_per_row == 0) {
$show_vertical_separator = ' ';
} else {
$show_vertical_separator = $verticalseparator;
}

// Category Link
$caturl = JRoute::_ ( 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id );

// Show Category ?>
<div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
<div class="spacer">
<h2>
<a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
<?php echo $category->category_name ?>
<br />
<?php // if ($category->ids) {
echo $category->images[0]->displayMediaThumb("",false);
//} ?>
</a>
</h2>
</div>
</div>
<?php
$iCategory ++;

// Do we need to close the current row now?
if ($iCol == $categories_per_row) { ?>
<div class="clear"></div>
</div>
<?php
$iCol = 1;
} else {
$iCol ++;
}
}
}
// Do we need a final closing row tag?
if ($iCol != 1) { ?>
<div class="clear"></div>
</div>
<?php } ?>
</div>

<?php }
}
?>
<div class="browse-view">
    <?php
if (!empty($this->keyword)) {
?>
<h3><?php echo $this->keyword; ?></h3>
<?php
} ?>
  <?php if ($this->search !==null ) { ?>
    <form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&limitstart=0&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="get">

    <!--BEGIN Search Box --><div class="virtuemart_search">
    <?php echo $this->searchcustom ?>
    <br />
    <?php echo $this->searchcustomvalues ?>
    <input name="keyword" class="inputbox" type="text" size="20" value="<?php echo $this->keyword ?>" />
    <input type="submit" value="<?php echo JText::_('COM_VIRTUEMART_SEARCH')?>" class="button" onclick="this.form.keyword.focus();"/>
    </div>
    <input type="hidden" name="search" value="true" />
    <input type="hidden" name="view" value="category" />

    </form>
<!-- End Search Box -->
<?php } ?>

<?php // Show child categories
if (!empty($this->products)) {
?>
<div class="orderby-displaynumber">
<div class="width70 floatleft">
<?php echo $this->orderByList['orderby']; ?>
<?php echo $this->orderByList['manufacturer']; ?>
</div>
<div class="width30 floatright display-number"><?php echo $this->vmPagination->getResultsCounter();?><br/><?php echo $this->vmPagination->getLimitBox(); ?></div>
<div class="vm-pagination">
<?php echo $this->vmPagination->getPagesLinks(); ?>
<span style="float:right"><?php echo $this->vmPagination->getPagesCounter(); ?></span>
</div>

<div class="clear"></div>
</div> <!-- end of orderby-displaynumber -->

<h1><?php echo $this->category->category_name; ?></h1>

<?php
// Category and Columns Counter
$iBrowseCol = 1;
$iBrowseProduct = 1;

// Calculating Products Per Row
$BrowseProducts_per_row = $this->perRow;
$Browsecellwidth = ' width'.floor ( 100 / $BrowseProducts_per_row );

// Separator
$verticalseparator = " vertical-separator";

// Count products
$BrowseTotalProducts = 0;
foreach ( $this->products as $product ) {
   $BrowseTotalProducts ++;
}

// Start the Output
foreach ( $this->products as $product ) {

// Show the horizontal seperator
if ($iBrowseCol == 1 && $iBrowseProduct > $BrowseProducts_per_row) { ?>
<div class="horizontal-separator"></div>
<?php }

// this is an indicator wether a row needs to be opened or not
if ($iBrowseCol == 1) { ?>
<div class="row">
<?php }

// Show the vertical seperator
if ($iBrowseProduct == $BrowseProducts_per_row or $iBrowseProduct % $BrowseProducts_per_row == 0) {
$show_vertical_separator = ' ';
} else {
$show_vertical_separator = $verticalseparator;
}

// Show Products ?>
<div class="product floatleft<?php echo $Browsecellwidth . $show_vertical_separator ?>">
<div class="spacer">
<div class="width30 floatleft center">
<?php /** @todo make image popup */
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
?>


<!-- The "Average Customer Rating" Part -->
<?php if ($this->showRating) { ?>
<span class="contentpagetitle"><?php echo JText::_('COM_VIRTUEMART_CUSTOMER_RATING')?>:</span>
<br />
<?php
// $img_url = JURI::root().VmConfig::get('assets_general_path').'/reviews/'.$product->votes->rating.'.gif';
// echo JHTML::image($img_url, $product->votes->rating.' '.JText::_('COM_VIRTUEMART_REVIEW_STARS'));
// echo JText::_('COM_VIRTUEMART_TOTAL_VOTES').": ". $product->votes->allvotes; ?>
<?php } ?>

<?php
if (!VmConfig::get('use_as_catalog') and !(VmConfig::get('stockhandle','none')=='none') && (VmConfig::get ( 'display_stock', 1 )) ){?>
<!-- if (!VmConfig::get('use_as_catalog') and !(VmConfig::get('stockhandle','none')=='none')){?> -->
<div class="paddingtop8">
<span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>
<span class="stock-level"><?php echo JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP')?></span>
</div>
<?php }?>
</div>

<div class="width70 floatright">

<h2><?php echo JHTML::link($product->link, $product->product_name); ?></h2>

<?php // Product Short Description
if(!empty($product->product_s_desc)) { ?>
<p class="product_s_desc">
<?php echo shopFunctionsF::limitStringByWord($product->product_s_desc, 40, '...')?>
</p>
<?php } ?>

<div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
<?php
if ($this->show_prices == '1') {
if( $product->product_unit && VmConfig::get('vm_price_show_packaging_pricelabel')) {
echo "<strong>". JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT').' ('.$product->product_unit."):</strong>";
}
if(empty($product->prices) and VmConfig::get('askprice',1) and empty($product->images[0]->file_is_downloadable) ){
echo JText::_('COM_VIRTUEMART_PRODUCT_ASKPRICE');
}
//todo add config settings
if( $this->showBasePrice){
echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);
echo $this->currency->createPriceDiv('basePriceVariant','COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT',$product->prices);
}
echo $this->currency->createPriceDiv('variantModification','COM_VIRTUEMART_PRODUCT_VARIANT_MOD',$product->prices);
echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
echo $this->currency->createPriceDiv('discountedPriceWithoutTax','COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE',$product->prices);
echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);
echo $this->currency->createPriceDiv('priceWithoutTax','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX',$product->prices);
echo $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices);
echo $this->currency->createPriceDiv('taxAmount','COM_VIRTUEMART_PRODUCT_TAX_AMOUNT',$product->prices);
} ?>
</div>

<p>
<?php // Product Details Button
echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'product-details'));
?>
</p>

</div>
<div class="clear"></div>
</div><!-- end of spacer -->
</div> <!-- end of product -->
<?php

   // Do we need to close the current row now?
   if ($iBrowseCol == $BrowseProducts_per_row || $iBrowseProduct == $BrowseTotalProducts) {?>
   <div class="clear"></div>
   </div> <?php
/**
 *
 * Show the product details page
 *
 * @package VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen
 * @todo handle child products
 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: default_addtocart.php 5409 2012-02-09 13:52:54Z alatak $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>
<div class="addtocart-area">

    <form method="post" class="product js-recalculate" action="index.php" >
<?php // Product custom_fields
if (!empty($product->customfieldsCart)) { ?>
    <div class="product-fields">
<?php foreach ($product->customfieldsCart as $field) { ?>
    <div class="product-field product-field-type-<?php echo $field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->custom_title)?></b></span>
<?php if ($field->custom_tip)
    echo JHTML::tooltip($field->custom_tip, JText::_($field->custom_title), 'tooltip.png'); ?>
<span class="product-field-display"><?php echo $field->display ?></span>

<span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
    </div><br />
    <?php
}
?>
    </div>
<?php
}
/* Product custom Childs
* to display a simple link use $field->virtuemart_product_id as link to child product_id
* custom_value is relation value to child
*/

if (!empty($product->customsChilds)) {
    ?>
    <div class="product-fields">
    <?php foreach ($product->customsChilds as $field) { ?>
    <div class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title)?></b></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value)?></span>
<span class="product-field-display"><?php echo $field->display ?></span>

    </div><br />
<?php } ?>
    </div>
<?php } ?>

<div class="addtocart-bar">

<?php // Display the quantity box  ?>
<!-- <label for="quantity<?php echo $product->virtuemart_product_id; ?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
    <span class="quantity-box">
<input type="text" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($product->min_order_level) && (int) $product->min_order_level > 0) {
    echo $product->min_order_level;
} else {
    echo '1';
} ?>" />
    </span>
    <span class="quantity-controls js-recalculate">
<input type="button" class="quantity-controls quantity-plus" />
<input type="button" class="quantity-controls quantity-minus" />
    </span>
    <?php // Display the quantity box END ?>

    <?php
    // Add the button
    $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
    $button_cls = 'addtocart-button'; //$button_cls = 'addtocart_button';
    $button_name = 'addtocart'; //$button_cls = 'addtocart_button';
    // Display the add to cart button
    $stockhandle = VmConfig::get('stockhandle', 'none');
    if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($product->product_in_stock - $product->product_ordered) < 1) {
$button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls = 'notify-button';
$button_name = 'notifycustomer';
    }
    //vmdebug('$stockhandle '.$stockhandle.' and stock '.$product->product_in_stock.' ordered '.$product->product_ordered);
    ?>
    <span class="addtocart-button">
<input type="submit" name="<?php echo $button_name ?>"  class="<?php echo $button_cls ?>" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
    </span>

    <div class="clear"></div>
</div>

<?php // Display the add to cart button END  ?>
<input type="hidden" class="pname" value="<?php echo $product->product_name ?>" />
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
    </form>

    <div class="clear"></div>
</div>
<!-- end of row -->
      <?php
      $iBrowseCol = 1;
   } else {
      $iBrowseCol ++;
   }

   $iBrowseProduct ++;
} // end of foreach ( $this->products as $product )
// Do we need a final closing row tag?
if ($iBrowseCol != 1) { ?>
<div class="clear"></div>

<?php
}
?>
<!-- /div removed valerie -->
<div class="vm-pagination"><?php echo $this->vmPagination->getPagesLinks(); ?><span style="float:right"><?php echo $this->vmPagination->getPagesCounter(); ?></span></div>
<!-- /div removed valerie -->
<?php } elseif ($this->search !==null ) echo JText::_('COM_VIRTUEMART_NO_RESULT').($this->keyword? ' : ('. $this->keyword. ')' : '')
?>
</div><!-- end browse-view -->
выглядеть это будет следующим образом , конечно тут еще нужно поработать над дизайном, но функционал на лицо
*

vitalyx

  • Захожу иногда
  • 99
  • 14 / 0
кстати по поводу ошибки    Error the quantity of the product for calculation is 0, please notify the shopowner, the product id 0
во всех браузерах  все замечательно, но кроме Firefox.   ;D данную ошибку удалось исправить закомментировав само сообщение об ошибке в файле VirtueMart / administrator / components / com_virtuemart / helpers / calculationh.php
в строке где то 447 меняем
Код
JError::raiseWarning(710, 'Error the quantity of the product for calculation is 0, please notify the shopowner, the product id ' . $product->virtuemart_product_id);
continue;
на
Код
/*JError::raiseWarning(710, 'Error the quantity of the product for calculation is 0, please notify the shopowner, the product id ' . $product->virtuemart_product_id);
continue;*/
*

Polosat

  • Захожу иногда
  • 202
  • 7 / 0
  • Мечты - это то, из чего сделано будущее
Если в спике категории товары выводятся не по одному, а по 2 или 3 штуки, тогда съедается кнопка купить у 2 и 3 товаров...

addtocart-area слишком большая

кто подскажет как решить?
*

morph

  • Давно я тут
  • 923
  • 105 / 0
Цитировать
<?php // Add To Cart Button
                        if (!VmConfig::get('use_as_catalog',0)) { ?>
                            <div class="addtocart-area">
                                <form method="post" class="product js-recalculate" action="index.php" >
                                    <?php // Product custom_fields
                                    if (!empty($product->customfieldsCart)) {  ?>
                                        <div class="product-fields">
                                            <?php foreach ($product->customfieldsCart as $field)
                                        { ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
                                            <div class="product-fields-title"  ><?php echo  JText::_($field->custom_title)?></div>
                                            <?php if ($field->custom_tip) echo JHTML::tooltip($field->custom_tip,  JText::_($field->custom_title), 'tooltip.png'); ?>
                                            <span class="product-field-display"><?php echo $field->display ?></span>
                                            <span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
                                        </div>
                                            <?php
                                        }
                                            ?>
                                        </div>
                                        <?php }
                                    if (!empty($product->customsChilds)) {  ?>
                                        <div class="product-fields">
                                            <?php foreach ($product->customsChilds as $field) {  ?>
                                            <div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
                                                <span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title)?></b></span>
                                                <span class="product-field-desc"><?php echo JText::_($field->field->custom_value)?></span>
                                                <span class="product-field-display"><?php echo $field->display ?></span>
                                            </div>
                                            <?php
                                        } ?>
                                        </div>
                                        <?php } ?>
                                    <div class="addtocart-bar">
                                  <span class="quantity-box">
                                     <input type="text" class="quantity-input" name="quantity[]" value="<?php if(isset($product->min_order_level) && (int) $product->min_order_level > 0){echo $product->min_order_level;} else{ echo '1'; } ?>" />
                                  </span>
                                  <span class="quantity-controls">
                                     <input type="button" class="quantity-controls quantity-plus" />
                                     <input type="button" class="quantity-controls quantity-minus" />
                                  </span>
                                        <?php
                                        $button_lbl = 'В корзину';
                                        $button_cls = 'addtocart-button';
                                        $button_name = 'addtocart';
                                        // Display the add to cart button
                                        $stockhandle = VmConfig::get('stockhandle','none');
                                        if(($stockhandle=='disableit' or $stockhandle=='disableadd') and ($product->product_in_stock - $product->product_ordered)<1){
                                            $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
                                            $button_cls = 'notify-button';
                                            $button_name = 'notifycustomer';
                                        }
                                        vmdebug('$stockhandle '.$stockhandle.' and stock '.$product->product_in_stock.' ordered '.$product->product_ordered);
                                        ?>
                                        <span class="addtocart-button-cont">
                                     <input type="submit" name="<?php echo $button_name ?>"  class="<?php echo $button_cls ?>" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
                                  </span>
                                        <div class="clear"></div>
                                    </div>
                                    <input type="hidden" class="pname" value="<?php echo $product->product_name ?>" />
                                    <input type="hidden" name="option" value="com_virtuemart" />
                                    <input type="hidden" name="view" value="cart" />
                                    <noscript><input type="hidden" name="task" value="add" /></noscript>
                                    <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
                                    <input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
                                    <input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
                                </form>

                                <div class="clear"></div>
                            </div>
                            <?php }   ?>
вставляем в components\com_virtuemart\views\categories\tmpl\default.php

еще правим косяк в components\com_virtuemart\assets\js\vmprices.js
везде где есть .click(function() меняем на .unbind('click').click(function()

тоесть снимаем возможность дубляжа кликов, а то в корзину по несколько товаров пулять будет

а в остальном цсс вам в помощь
*

Polosat

  • Захожу иногда
  • 202
  • 7 / 0
  • Мечты - это то, из чего сделано будущее
Спасибо в новой версии косяк с "по 2шт" в заказ решен. CSS как только не правил - а кнопка купить все равно только по одной левой колонке показывалась. Поэтому и решил спросить  ::)
*

berezhnuy1

  • Новичок
  • 2
  • 0 / 0
Доброго времени суток! Мне очень помог этот пост, благодарю вас. Я добавил все что выше описано во всплывающем окне. Но столкнулся с такой проблемой: у меня счетчик +- стал считать через 1. Помогите пожалуйста решить проблему. http://poctelka.net/bambuk
*

berezhnuy1

  • Новичок
  • 2
  • 0 / 0
Да, и собственно сам код

Код
<div class="bubbleInfo">
    <div id="download" class="trigger">
<?php /** @todo make image popup */
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
?>
</div>
    <div id="dpop" class="popup1">
<?php /** @todo make image popup */
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
?>
                       
<div class="detailsleft">     

<?php // Product Title ?>
<h1><?php echo $product->product_name ?></h1>
<?php // Product Title END ?>
   
<?php
if($this->showRating){
$rating = empty($this->rating)? JText::_('COM_VIRTUEMART_UNRATED'):$this->rating->rating;
echo JText::_('COM_VIRTUEMART_RATING'). round($rating, 2);
}

// Product Price
if ($this->show_prices) { ?>
<div class="product-price" id="productPrice<?php echo $product->virtuemart_product_id ?>">
<?php

if ($this->showBasePrice) {
echo $this->currency->createPriceDiv ( 'basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices );
echo $this->currency->createPriceDiv ( 'basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $product->prices );
}

echo $this->currency->createPriceDiv ( 'variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices );
echo $this->currency->createPriceDiv ( 'basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices );
echo $this->currency->createPriceDiv ( 'discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $product->prices );
echo $this->currency->createPriceDiv ( 'salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices );
echo $this->currency->createPriceDiv ( 'salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices );
echo $this->currency->createPriceDiv ( 'priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices );
echo $this->currency->createPriceDiv ( 'discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices );
echo $this->currency->createPriceDiv ( 'taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices ); ?>
</div>
<?php } ?>
                       
                       
                       
                       
<?php // Add To Cart Button
if (!VmConfig::get('use_as_catalog',0)) { ?>
<div class="addtocart-area">

<form method="post" class="product js-recalculate" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">
<?php // Product custom_fields
if (!empty($product->customfieldsCart)) {  ?>
<div class="product-fields">
<?php foreach ($product->customfieldsCart as $field)
{ ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
<span class="product-fields-title" ><b><?php echo  JText::_($field->custom_title)?></b></span>
<?php if ($field->custom_tip) echo JHTML::tooltip($field->custom_tip,  JText::_($field->custom_title), 'tooltip.png'); ?>
<span class="product-field-display"><?php echo $field->display ?></span>

<span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
</div><br />
<?php
}
?>
</div>
<?php }
/* Product custom Childs
  * to display a simple link use $field->virtuemart_product_id as link to child product_id
  * custom_value is relation value to child
  */

if (!empty($product->customsChilds)) {  ?>
<div class="product-fields">
<?php foreach ($product->customsChilds as $field) {  ?>
<div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title)?></b></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value)?></span>
<span class="product-field-display"><?php echo $field->display ?></span>

</div><br />
<?php
} ?>
</div>
<?php } ?>

<div class="addtocart-bar">

<?php // Display the quantity box ?>
<!-- <label for="quantity<?php echo $product->virtuemart_product_id;?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
<span class="quantity-box">
<input type="text" class="quantity-input" name="quantity[]" value="<?php if(isset($product->min_order_level) && (int) $product->min_order_level > 0){echo $product->min_order_level;} else{ echo '1'; } ?>" />
</span>
<span class="quantity-controls">
<input type="button" class="quantity-controls quantity-plus" />
<input type="button" class="quantity-controls quantity-minus" />
</span>
<?php // Display the quantity box END ?>

<?php // Add the button
$button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
$button_cls = ''; //$button_cls = 'addtocart_button';
if (VmConfig::get('check_stock') == '1' && !$product->product_in_stock) {
$button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
$button_cls = 'notify-button';
} ?>

<?php // Display the add to cart button ?>
<span class="addtocart-button">
<input type="submit" name="addtocart"  class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
</span>

<div class="clear"></div>
</div>

<?php // Display the add to cart button END ?>
<input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
<?php /** @todo Handle the manufacturer view */ ?>
<input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
<input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form>

<div class="clear"></div>
</div>
<?php }  // Add To Cart Button END ?>                       
</div><!-- detailsleft -->
<div class="detailright">
<?php // Product Description
if (!empty($product->product_desc)) { ?>
<div class="product-description">
<?php /** @todo Test if content plugins modify the product description */ ?>
<span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE')?></span>
<?php echo $product->product_desc; ?>
</div>
<?php } // Product Description END ?>
</div><!-- detailsleft_right -->
    </div>
</div>
*

diggs

  • Захожу иногда
  • 60
  • 4 / 0
Цитировать
Доброго времени суток! Мне очень помог этот пост, благодарю вас. Я добавил все что выше описано во всплывающем окне. Но столкнулся с такой проблемой: у меня счетчик +- стал считать через 1. Помогите пожалуйста решить проблему. http://poctelka.net/bambuk

Тоже столкнулся с такой проблемой. Был нарушен шаг у quantity box. Весь товар прибавлялся и отнимался с шагом в 2, т.е не 1, 2, 3, 4, и т.д а 1, 3, 5, 7 и т.д

В /components/com_virtuemart/assets/js/vmprices.js

Код
plus   = cart.find('.quantity-plus'),
minus  = cart.find('.quantity-minus'),

заменить на

Код
plus   = cart.find('.quantity-plus').unbind("click"),
minus  = cart.find('.quantity-minus').unbind("click"),
« Последнее редактирование: 12.04.2012, 18:56:22 от diggs »
*

timonych

  • Осваиваюсь на форуме
  • 18
  • 5 / 0
Если кому надо убрать поле количества ввода товара, то вот небольшой код

Код
 <?php // Display the quantity box ?>
 <input type="hidden" name="quantity[]" value="<?php if(isset($product->min_order_level) && (int) $product->min_order_level > 0){echo $product->min_order_level;} else{ echo '1'; } ?>" />
 <?php // Display the quantity box END ?>
*

masik_

  • Осваиваюсь на форуме
  • 42
  • 3 / 0
Вот готовый код - есть артикул, +-, размер картинки товара увеличен в 3 раза, тока шаг сделайте как рекомендует diggs  В /components/com_virtuemart/assets/js/vmprices.js

Код:
plus   = cart.find('.quantity-plus'),
minus  = cart.find('.quantity-minus'),

заменить на

Код:
plus   = cart.find('.quantity-plus').unbind("click"),
minus  = cart.find('.quantity-minus').unbind("click"),

Вот сам шаблон:

Код
<?php
/**
*
* Show the products in a category
*
* @package   VirtueMart
* @subpackage
* @author RolandD
* @author Max Milbers
* @todo add pagination
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: default.php 5120 2011-12-18 18:29:26Z electrocity $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
JHTML::_( 'behavior.modal' );
/* javascript for list Slide
  Only here for the order list
  can be changed by the template maker
*/
$js = "
jQuery(document).ready(function () {
   jQuery('.orderlistcontainer').hover(
      function() { jQuery(this).find('.orderlist').stop().show()},
      function() { jQuery(this).find('.orderlist').stop().hide()}
   )
});
";

$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
?>

<div class="category_description">
   <?php echo $this->category->category_description ; ?>
</div>
<?php
/* Show child categories */

if ( VmConfig::get('showCategory',1) ) {
   if ($this->category->haschildren) {

      // Category and Columns Counter
      $iCol = 1;
      $iCategory = 1;

      // Calculating Categories Per Row
      $categories_per_row = VmConfig::get ( 'categories_per_row', 3 );
      $category_cellwidth = ' width'.floor ( 100 / $categories_per_row );

      // Separator
      $verticalseparator = " vertical-separator";
      ?>

      <div class="category-view">

      <?php // Start the Output
      if(!empty($this->category->children)){
      foreach ( $this->category->children as $category ) {

         // Show the horizontal seperator
         if ($iCol == 1 && $iCategory > $categories_per_row) { ?>
         <div class="horizontal-separator"></div>
         <?php }

         // this is an indicator wether a row needs to be opened or not
         if ($iCol == 1) { ?>
         <div class="row">
         <?php }

         // Show the vertical seperator
         if ($iCategory == $categories_per_row or $iCategory % $categories_per_row == 0) {
            $show_vertical_separator = ' ';
         } else {
            $show_vertical_separator = $verticalseparator;
         }

         // Category Link
         $caturl = JRoute::_ ( 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id );

            // Show Category ?>
            <div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
               <div class="spacer">
                  <h2>
                     <a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
                     <?php echo $category->category_name ?>
                     <br />
                     <?php // if ($category->ids) {
                        echo $category->images[0]->displayMediaThumb("",false);
                     //} ?>
                     </a>
                  </h2>
               </div>
            </div>
         <?php
         $iCategory ++;

      // Do we need to close the current row now?
      if ($iCol == $categories_per_row) { ?>
      <div class="clear"></div>
      </div>
         <?php
         $iCol = 1;
      } else {
         $iCol ++;
      }
   }
   }
   // Do we need a final closing row tag?
   if ($iCol != 1) { ?>
      <div class="clear"></div>
      </div>
   <?php } ?>
</div>
<?php }
}

// Show child categories
if (!empty($this->products)) {
   if (!empty($this->keyword)) {
      ?>
      <h3><?php echo $this->keyword; ?></h3>
      <?php
   }
   ?>

<?php // Category and Columns Counter
$iBrowseCol = 1;
$iBrowseProduct = 1;

// Calculating Products Per Row
$BrowseProducts_per_row = $this->perRow;
$Browsecellwidth = ' width'.floor ( 100 / $BrowseProducts_per_row );

// Separator
$verticalseparator = " vertical-separator";
?>

<div class="browse-view">

   <h1><?php echo $this->category->category_name; ?></h1>
      <form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&limitstart=0&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="get">
      <?php if ($this->search) { ?>
      <!--BEGIN Search Box --><div class="virtuemart_search">
      <?php echo $this->searchcustom ?>
      <br />
      <?php echo $this->searchcustomvalues ?>
      <input style="height:16px;vertical-align :middle;" name="keyword" class="inputbox" type="text" size="20" value="<?php echo $this->keyword ?>" />
      <input type="submit" value="<?php echo JText::_('COM_VIRTUEMART_SEARCH')?>" class="button" onclick="this.form.keyword.focus();"/>
      </div>
            <input type="hidden" name="search" value="true" />
            <input type="hidden" name="view" value="category" />


      <!-- End Search Box -->
      <?php } ?>
         <div class="orderby-displaynumber">
            <div class="width70 floatleft">
               <?php echo $this->orderByList['orderby']; ?>
               <?php echo $this->orderByList['manufacturer']; ?>
            </div>
            <div class="width30 floatright display-number"><?php echo $this->vmPagination->getResultsCounter();?><br/><?php echo $this->vmPagination->getLimitBox(); ?></div>
            <div id="bottom-pagination">
               <?php echo $this->vmPagination->getPagesLinks(); ?>
               <span style="float:right"><?php echo $this->vmPagination->getPagesCounter(); ?></span>
            </div>

         <div class="clear"></div>
         </div>
      </form>
<?php // Start the Output
foreach ( $this->products as $product ) {

   // Show the horizontal seperator
   if ($iBrowseCol == 1 && $iBrowseProduct > $BrowseProducts_per_row) { ?>
   <div class="horizontal-separator"></div>
   <?php }

   // this is an indicator wether a row needs to be opened or not
   if ($iBrowseCol == 1) { ?>
   <div class="row">
   <?php }

   // Show the vertical seperator
   if ($iBrowseProduct == $BrowseProducts_per_row or $iBrowseProduct % $BrowseProducts_per_row == 0) {
      $show_vertical_separator = ' ';
   } else {
      $show_vertical_separator = $verticalseparator;
   }

      // Show Products ?>
      <div class="product floatleft<?php echo $Browsecellwidth . $show_vertical_separator ?>">
         <div class="spacer">
            <div class="width100 floatleft center">
               <?php /** @todo make image popup */
                     echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
                  ?>


              
            </div>

            <div class="width70 floatright">

               <h2><?php echo JHTML::link($product->link, $product->product_name); ?></h2>

                  <?php // Product Short Description
                  if(!empty($product->product_s_desc)) { ?>
                  <p class="product_s_desc">
                  <?php echo shopFunctionsF::limitStringByWord($product->product_s_desc, 40, '...')?>
                  </p>
                  <?php } ?>
<?php echo $product->product_sku ?>
               <div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
               <?php
               if ($this->show_prices == '1') {
                  if( $product->product_unit && VmConfig::get('vm_price_show_packaging_pricelabel')) {
                     echo "<strong>". JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT').' ('.$product->product_unit."):</strong>";
                  }

                  //todo add config settings
                  if( $this->showBasePrice){
                     echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);
                     echo $this->currency->createPriceDiv('basePriceVariant','COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT',$product->prices);
                  }
                  echo $this->currency->createPriceDiv('variantModification','COM_VIRTUEMART_PRODUCT_VARIANT_MOD',$product->prices);
                  echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
                  echo $this->currency->createPriceDiv('discountedPriceWithoutTax','COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE',$product->prices);
                  echo $this->currency->createPriceDiv('salesPriceWithDiscount','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT',$product->prices);
                  echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);
                  echo $this->currency->createPriceDiv('priceWithoutTax','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX',$product->prices);
                  echo $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices);
                  echo $this->currency->createPriceDiv('taxAmount','COM_VIRTUEMART_PRODUCT_TAX_AMOUNT',$product->prices);
               } ?>
               </div>
          <form method="post" class="product" action="index.php" id="addtocartproduct<?php echo $product->virtuemart_product_id ?>">
   <?php // Product custom_fields
   if (!empty($this->product->customfieldsCart)) {  ?>
   <div class="product-fields">
      <?php foreach ($this->product->customfieldsCart as $field)
      { ?><div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
         <span class="product-fields-title" ><b><?php echo  JText::_($field->custom_title)?></b></span>
         <?php echo JHTML::tooltip($field->custom_tip,  JText::_($field->custom_title), 'tooltip.png'); ?>
         <span class="product-field-display"><?php echo $field->display ?></span>

         <span class="product-field-desc"><?php echo $field->custom_field_desc ?></span>
         </div><br/ >
         <?php
      }
      ?>
   </div>
   <?php }
    /* Product custom Childs
     * to display a simple link use $field->virtuemart_product_id as link to child product_id
     * custom_value is relation value to child
     */

   if (!empty($this->product->customsChilds)) {  ?>
      <div class="product-fields">
         <?php foreach ($this->product->customsChilds as $field) {  ?>
            <div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
            <span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title)?></b></span>
            <span class="product-field-desc"><?php echo JText::_($field->field->custom_value)?></span>
            <span class="product-field-display"><?php echo $field->display ?></span>

            </div><br/ >
            <?php
         } ?>
      </div>
   <?php } ?>

      <div class="addtocart-bar">

         <?php // Display the quantity box ?>
         <!-- <label for="quantity<?php echo $this->product->virtuemart_product_id;?>" class="quantity_box"><?php echo JText::_('COM_VIRTUEMART_CART_QUANTITY'); ?>: </label> -->
         <span class="quantity-box">
            <input type="text" class="quantity-input" name="quantity[]" value="1" />
         </span>
         <span class="quantity-controls">
            <input type="button" class="quantity-controls quantity-plus" />
            <input type="button" class="quantity-controls quantity-minus" />
         </span>
         <?php // Display the quantity box END ?>

         <?php // Add the button
         $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
         $button_cls = ''; //$button_cls = 'addtocart_button';
         if (VmConfig::get('check_stock') == '1' && !$this->product->product_in_stock) {
            $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
            $button_cls = 'notify-button';
         } ?>

         <?php // Display the add to cart button ?>
         <span class="addtocart-button">
            <input type="submit" name="addtocart"  class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
         </span>

      <div class="clear"></div>
      </div>

      <?php // Display the add to cart button END ?>
      <input type="hidden" class="pname" value="<?php echo $product->product_name ?>">
      <input type="hidden" name="option" value="com_virtuemart" />
      <input type="hidden" name="view" value="cart" />
      <noscript><input type="hidden" name="task" value="add" /></noscript>
      <input type="hidden" name="virtuemart_product_id[]" value="<?php echo $product->virtuemart_product_id ?>" />
      <?php /** @todo Handle the manufacturer view */ ?>
      <input type="hidden" name="virtuemart_manufacturer_id" value="<?php echo $product->virtuemart_manufacturer_id ?>" />
      <input type="hidden" name="virtuemart_category_id[]" value="<?php echo $product->virtuemart_category_id ?>" />
</form> <BR>
               <p>
               <?php // Product Details Button
               echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'product-details'));
               ?>
               </p>

            </div>
         <div class="clear"></div>
         </div>
      </div>
   <?php
   $iBrowseProduct ++;

   // Do we need to close the current row now?
   if ($iBrowseCol == $BrowseProducts_per_row) { ?>
   <div class="clear"></div>
   </div>
      <?php
      $iBrowseCol = 1;
   } else {
      $iBrowseCol ++;
   }
}
// Do we need a final closing row tag?
if ($iBrowseCol != 1) { ?>
   <div class="clear"></div>
   </div>
<?php
}
?>
   <div id="bottom-pagination"><?php echo $this->vmPagination->getPagesLinks(); ?><span style="float:right"><?php echo $this->vmPagination->getPagesCounter(); ?></span></div>
</div>
<?php } ?>
« Последнее редактирование: 10.05.2012, 18:04:57 от masik_ »
*

masik_

  • Осваиваюсь на форуме
  • 42
  • 3 / 0
*

masik_

  • Осваиваюсь на форуме
  • 42
  • 3 / 0
*

masik_

  • Осваиваюсь на форуме
  • 42
  • 3 / 0
подскажите а как мне  уменьшить размер самой кнопки, я изменил текст "добавить в корзину" на "купить", а кнопка не уменьшилась?
и желательно сдвинуть подпись под картинкой влево, что бы было без абзаца.
спс.
« Последнее редактирование: 10.05.2012, 19:22:04 от masik_ »
*

ELLE

  • Глобальный модератор
  • 4510
  • 893 / 0
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться