Magento账户余额插件Magento Credit

Magento账户余额
Magento账户余额

推荐:http://www.mage-world.com/magento-store-credit-extension.html

账户余额,账户充值,类似的Magento插件google下”magento credit”可以找到好几个,大家可以试下哪一个适合自己。

这类插件的基本功能是,可以给账户充值,可以使用充值后的金额购买商品(如上图,在购物车结算的时候使用),可以送一定的金额给客户,可以查看账户充值的金额,消费历史记录等等。

继续阅读“Magento账户余额插件Magento Credit”

Magento快递物流配送时间插件

20131213112017

插件地址:http://www.magentocommerce.com/magento-connect/order-delivery-date-7864.html

此插件可以让顾客自己设置快递配送时间,方便客户安排人收货。

这个插件对于那些用不靠谱快递公司的人来说,没有什么用,因为快递哪一天到,快递公司自己都不知道。但是对于一些同城的服务,这个插件还是有用的,比如卖花,顾客定了,肯定是要选个送花的日期的,这样的情况是很有用的。此插件还有订单留言,方便客户针对订单留言,比如礼物卡片些什么等等做些备注。

继续阅读“Magento快递物流配送时间插件”

Magento免费的一页结账插件

Magento免费一页结账插件
Magento免费一页结账插件

Magento结账流程对于很多人来说,无法接受,因为步骤太多了。一页结账这个插件市面上有很多,现在更多了,每个都不同。现在推荐这个免费的,大家可以在自己的测试站上试下,地址:http://www.magentocommerce.com/magento-connect/iwd-free-one-page-one-step-checkout.html,有demo。

如果满意就可以用下,不满意直接google “magento onepage checkout”看下其它的。

插件有两种,一种是可以解决你问题的,一种是不能帮你解决问题的。

继续阅读“Magento免费的一页结账插件”

magento set image fit or fill the parent container

magento图片自适应容器大小
magento图片自适应容器大小

magento原始模板原先自带的图片处理会有白边,就是图片比例不符合代码中的尺寸时,magento会自动resize图片尺寸,并且自动加上白边。

其实去掉白边好搞,增加去白边的代码即可,如下

$this->helper('catalog/image')->init($_product, 'small_image')->constrainOnly(TRUE)->keepAspectRatio(TRUE)->keepFrame(FALSE)->resize(210);

keepFrame(FALSE)这个是控制白边的,参数false就是不带白边。resize控制图片的比例,单独一个数字,如上面 200,是将图片搞成200*200的尺寸,这个只有在有白边的时候才有效,没有白边了这个resize就不太管用了,会按照实际比例缩放图片,你可以试试。

对于很多人来说也许去掉白边就够用了,但是有的时候有变态的情况,比如图片比例是1:5甚至1:10,尼玛 – – ! 怎么会有这么变态的图片比例,这会将你的布局搞的乱七八糟。如果你有这个情况,又想控制图片的最大宽高的话,看这篇博文会有所帮助。

首先我们将magento的图片的白边去掉了,下一步就是使图片自适应到你设置的大小,即使比例差别很大,也自适应下,图片不超出你指定的长宽。相当于,你设置了图片的最大宽度,最大高度。这样对于你布局来说,会好狠多。

jquery有很多图片缩放,自适应的插件,我找到的这个是我自己认为比较合适的 http://imgscale.kjmeath.com/,当然大家也可以找自己喜欢的,或者更满足大家自己需求的js插件。

看插件的说明,他要求在图片的外层有个div或者什么的是block类型的html标签,并且css中写上宽高。

继续阅读“magento set image fit or fill the parent container”

获取magento全部商品评价reviews

magento-all-reviews
magento-all-reviews

最新写个magento获取评价的插件,获取全部评价的代码分享下。

如下代码片段如下,仅供参考:

Block中的代码如下

class Hellokeykey_Allreviews_Block_Allreviews extends Mage_Core_Block_Template
{
	protected $_collection;

	protected function _construct()
    {
		$this->_collection = Mage::getModel('review/review')->getProductCollection();
        $this->_collection
            ->addStoreFilter(Mage::app()->getStore()->getId())
            //->addCustomerFilter(Mage::getSingleton('customer/session')->getCustomerId())
			->addStatusFilter(1)  //const STATUS_APPROVED       = 1;
            ->setDateOrder();
    }

	// add by lee

	public function getReviewsSummaryHtml(Mage_Catalog_Model_Product $product, $templateType = false, $displayIfNoReviews = false)
    {
        return
            $this->getLayout()->createBlock('rating/entity_detailed')
                ->setEntityId($this->getProduct()->getId())
                ->toHtml()
            .
            $this->getLayout()->getBlock('product_review_list.count')
                ->assign('count', $this->getReviewsCollection()->getSize())
                ->toHtml()
            ;
    }

	/**
     * Gets collection items count
     *
     * @return int
     */
    public function count()
    {
        return $this->_collection->getSize();
    }

    /**
     * Get html code for toolbar
     *
     * @return string
     */
    public function getToolbarHtml()
    {
        return $this->getChildHtml('toolbar');
    }

    /**
     * Initializes toolbar
     *
     * @return Mage_Core_Block_Abstract
     */
    protected function _prepareLayout()
    {
        $toolbar = $this->getLayout()->createBlock('page/html_pager', 'customer_review_list.toolbar')
            ->setCollection($this->getCollection());

        $this->setChild('toolbar', $toolbar);
        return parent::_prepareLayout();
    }

	/**
     * Get collection
     *
     * @return Mage_Review_Model_Resource_Review_Product_Collection
     */
    protected function _getCollection()
    {
        return $this->_collection;
    }

    /**
     * Get collection
     *
     * @return Mage_Review_Model_Resource_Review_Product_Collection
     */
    public function getCollection()
    {
        return $this->_getCollection();
    }

    /**
     * Get product link
     *
     * @return string
     */
    public function getProductReviewLink()
    {
        return Mage::getUrl('review/product/list/id/');
    }

    /**
     * Format date in short format
     *
     * @param $date
     * @return string
     */
    public function dateFormat($date)
    {
        return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
    }

	protected function _beforeToHtml()
    {
        $this->_getCollection()
            ->load()
            ->addReviewSummary();
        return parent::_beforeToHtml();
    }
}

上面代码来自核心代码的修改,注意的地方就是去掉用户筛选出状态是通过的评价

maegnto模板文件中输出,模板文件中的代码如下

<?php if( $this->getCollection() && $this->count()): ?>
    <?php echo $this->getToolbarHtml() ?>
		<table class="data-table" id="my-reviews-table">
            <col width="1" />
            <col width="210" />
            <col width="1" />
            <col />
            <tbody>
                <?php foreach ($this->getCollection() as $_review): ?>
                <?php
					$_product = Mage::getModel('catalog/product')->load($_review->getEntityPkValue());
					$storeId = Mage::app()->getStore()->getId();
					//$reviewsCount = Mage::getModel('review/review')->getTotalReviews($_review->getEntityPkValue(), true , $storeId);
				?>
				<tr>
                    <td>
						<P><strong><?php echo $_review->getNickname(); ?></strong></P>
						<span class="nobr"><?php echo $this->dateFormat($_review->getReviewCreatedAt()); ?></span>
					</td>
                    <td>
						<a href="<?php echo $_product->getProductUrl(); ?>" target="_blank"><?php echo $this->htmlEscape($_review->getName()) ?></a>
						<img src="<?php echo $_product->getImageUrl() ?>" />
					</td>
                    <td>
                    <?php if($_review->getSum()): ?>
                        <div class="rating-box">
                            <div class="rating" style="width:<?php echo ( $_review->getSum() / $_review->getCount() ) ?>%;"></div>
                        </div>
						<a href="<?php echo $this->getProductReviewLink() ?>id/<?php echo $_review->getEntityPkValue() ?>" target="_blank"><?php echo $_review->getCount() ?> <?php echo $this->__('reviews') ?></a>
                    <?php endif; ?>
                    </td>
                    <td><?php echo $this->helper('review')->getDetailHtml($_review->getDetail()) ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
	    <script type="text/javascript">decorateTable('my-reviews-table')</script>
    <?php echo $this->getToolbarHtml() ?>
<?php else: ?>
    <p><?php echo $this->__('You have submitted no reviews.') ?></p>
<?php endif; ?>

此为magento 1.7.2.0测试代码,不建议用于生产环境。大家根据自己magento版本和经验适当修改。

继续阅读“获取magento全部商品评价reviews”

Magento A-Z插件

我的插件店上线了,这是我和朋友推出的第一个插件,大家看视频和demo来了解这个插件的作用吧。

demo地址:http://demo.hellokey.com/

购买地址:http://www.hellokey.com/cn/magento-a-z-extension   (支持paypal付款或网银支付宝付款)

视频介绍如下:插件如果有更新,视频中可能并未介绍,请以demo为准。

继续阅读“Magento A-Z插件”

Magento的颜色选择插件和团购插件

color swatches

很多人需要颜色选择插件和团购插件,官网的插件市场Magento Connect中提供了大量的这些插件,大家可以时刻关注下是否有自己需要的插件。

Magento商品颜色选择插件:http://www.magentocommerce.com/magento-connect/catalogsearch/result/?id=&s=1&pl=0&te=0&q=Color+Swatch&t=0&p=1

Magento团购插件: http://www.magentocommerce.com/magento-connect/catalogsearch/result/?q=Groupon&pl=0

继续阅读“Magento的颜色选择插件和团购插件”

Magento导入多图,自定义选项(3)

magento批量导入
magento批量导入

现在已经有视频教程,详见:http://www.hellokeykey.com/magento-chinese-tutorial-video/

如果你没有看前两篇介绍批量导入的文章,请先阅读前两篇文章。
Magento导入多图,自定义选项
Magento导入多图,自定义选项 (2)

在使用这个插件导入自定义选项的时候,我们发现导入的自定义选项的顺序,是按照字母顺序排列的。

比如,我们导入颜色下拉菜单,我们csv文件中的属性顺序是:  red,blue,white。但是导入后我们发现他们的顺序已经变成了:blue,red,white。也就是会按照字母的顺序来排列。

我们需要修改其插件代码,来fix这个问题。

需要修改的插件文件路径: app\code\community\CapacityWebSolutions\ImportProduct\Model\Convert\Adapter\product.php

代码片段说明:在大概132行的位置,添加 $i 变量,在大概210行位置,将sort_order的值换为$i++,这样就会按照导入顺序给导入值设置排序的权重。

	$i = 0;
        foreach ($importData as $field => $value) {
            if (in_array($field, $this->_inventoryFields)) {
                continue;
            }
            if (in_array($field, $this->_imageFields)) {
                continue;
            }
            $attribute = $this->getAttribute($field);
          	if (!$attribute) {

				if(strpos($field,':')!==FALSE && strlen($value)) {
				   $values=explode('|',$value);
				   if(count($values)>0) {
					  @list($title,$type,$is_required,$sort_order) = explode(':',$field);
					  $title = ucfirst(str_replace('_',' ',$title));
					  $custom_options[] = array(
						 'is_delete'=>0,
						 'title'=>$title,
						 'previous_group'=>'',
						 'previous_type'=>'',
						 'type'=>$type,
						 'is_require'=>$is_required,
						 'sort_order'=>$sort_order,
						 'values'=>array()
					  );
					  foreach($values as $v) {
						 $parts = explode(':',$v);
						 $title = $parts[0];
						 if(count($parts)>1) {
							$price_type = $parts[1];
						 } else {
							$price_type = 'fixed';
						 }
						 if(count($parts)>2) {
							$price = $parts[2];
						 } else {
							$price =0;
						 }
						 if(count($parts)>3) {
							$sku = $parts[3];
						 } else {
							$sku='';
						 }
						 if(count($parts)>4) {
							$sort_order = $parts[4];
						 } else {
							$sort_order = 0;
						 }
						 switch($type) {
							case 'file':
							     break;

							case 'field':
							case 'area':
							   $custom_options[count($custom_options) - 1]['max_characters'] = $sort_order;

							case 'date':
							case 'date_time':
							case 'time':
							   $custom_options[count($custom_options) - 1]['price_type'] = $price_type;
							   $custom_options[count($custom_options) - 1]['price'] = $price;
							   $custom_options[count($custom_options) - 1]['sku'] = $sku;
							   break;

							case 'drop_down':
							case 'radio':
							case 'checkbox':
							case 'multiple':
							default:
							   $custom_options[count($custom_options) - 1]['values'][]=array(
								  'is_delete'=>0,
								  'title'=>$title,
								  'option_type_id'=>-1,
								  'price_type'=>$price_type,
								  'price'=>$price,
								  'sku'=>$sku,
								  'sort_order'=>$i++,
							   );
							   break;
						 }
					  }
				   }
				}

                continue;
            }

 

 

继续阅读“Magento导入多图,自定义选项(3)”