国际电子商务技术 & Magento开发公司

Magento technologies

Welcome visitor! You canlogin orcreate an account.

热线:+86-0532-58973093

麦神电子商务
Mygod Technologies

官方认证开发工程师

关于magento中的google base

2012年11月2日星期五 Asia/Shanghai上午10:11:52

在magento中,1.4的版本中是有google base。

google base也是一种销售方式,不懂的可以查查谷歌,具体google base是个什么东西!

到了magento1.7,谷歌base没有了。

个人认为是竞争的问题。

google base是以一个很大的电商概念,ebay,亚马逊都是很大的面向全球的在线销售平台。

2011年,ebay收购magento,开设www.x.com,设立单独部门。

随后发布的magento1.7就没有google base的功能了,呵呵

自从ebay收购magento,更新也变慢了,版本基本不升级了,有的地方说magento在改框架。

这些都无从考证,我只记得,magento很久没更新了,很久,之前都是1-2个月就出一个新的子版本的。

商业化了,就不会在全心全意的为大众服务,赚取用户,提高声望!

0 Comments | Posted in magento原理 Magento新闻 By terry water

判断是否是一个导航分类页面

2012年10月24日星期三 Asia/Shanghai下午1:22:11

在magento的分类页面,当将一个页面设置成带有导航的页面的时候,我们需要判断这个页面是否是导航页面

判断是否是导航页面的方法是:

 $_category  = $this->getCurrentCategory();
    
    echo $_category->getIsAnchor();

输出为1,说明是分类侧栏带有导航的类型,如果输出为0,说明没有导航,OK!

0 Comments | Posted in magento原理 By terry water

magento的robots文件编写

2012年7月19日星期四 Asia/Shanghai上午9:50:27

magento是网店系统,我们突出的是我们的产品,所以,有很多路径我们不想让搜索引擎索引到,所以我们需要用robots文件进行限制

下面是麦神magento的robots.txt里面的内容,因为很多url重写和伪静态,所以,不要复制使用,这个格式是针对麦神Magento版本的

User-agent: *
Disallow: /home/
Disallow: /catalogsearch/advanced/
Disallow: /catalog/
Disallow: /sendfriend/
Disallow: /catalogsearch/
Disallow: /checkout/
Disallow: /customer/
Disallow: /directory/
Disallow: /index/
Disallow: /newsletter/
Disallow: /developertoolbar/
Disallow: /index.php/
Disallow: /default/
Disallow: /skin/
Disallow: /*?

解释:

Magento的首页选择的是home,所以www.sample.com/home是可以访问的,但是没有任何意义,而且页面也有问题,如果被搜索引擎搜索,让客户点进来,一看有问题,立马关掉走人,影响形象,所以需要禁止

因为麦神Magento的很多动态url伪静态了,所以带有?的动态URL可以禁止索引

index.php/这种路径和url rewrite的url都是可以访问的,会造成一个页面多个url,不稳定的url很致命,所以要把这种禁止掉!

其余的不在解释,当您的网站被谷歌收录后,会发现很多页面不想被收录,那个时候,您就总结出来了,那些页面需要被禁止掉。

0 Comments | Posted in magento原理 By terry water

在magneto系统中输出tier price的最小值

2012年6月16日星期六 Asia/Shanghai上午11:39:22

有的时候,我们想输出产品的tier price 的最小值!如图:

 

下面是解决的办法:


1.

在catalog/product/view文件夹下新建一个文件: getlowest.phtml
<?php

/**
* @E-Commercewebdesign.co.uk
*/
$_product = $this->getProduct();
$_tierPrices = $this->getTierPrices();
$_finalPriceInclTax = $this->helper('tax')->getPrice($_product, $_product->getFinalPrice(), true);

$_weeeTaxAmount = Mage::helper('weee')->getAmountForDisplay($_product);
if (Mage::helper('weee')->typeOfDisplay($_product, array(1,2,4))) {
$_weeeTaxAttributes = Mage::helper('weee')->getProductWeeeAttributesForDisplay($_product);
}

?>
<?php if (count($_tierPrices) > 0): ?>
<?php if ($this->getInGrouped()): ?>
<?php $_tierPrices = $this->getTierPrices($_product); ?>
<?php endif; ?>
<?php Mage::helper('weee')->processTierPrices($_product, $_tierPrices); ?>
<?php $i = 0; ?>
<?php $_tierPrices = array_reverse($_tierPrices); ?>
<?php foreach ($_tierPrices as $_price): ?>
<?php if($i==0){ ?>
<p style="font-weight:bold; font-size: 1em;">After tier pricing the lowest price you can have a Cowboy Hat is...
<span style="font-size:150%; text-decoration:underline;">
<?php echo $_price['formated_price']; ?>
</span>
<p>
<?php $i++; ?>
<?php } ?>
<?php endforeach ?>
<?php endif;?>

 

2. 

在catalog_product_view这个block下面加入这个block

<block type="catalog/product_view" name="getlowest" as="getlowest" template="catalog/product/view/getlowest.phtml" />

3. 

在希望显示tier price最小值的地方,调用下面的代码:

<?php echo $this->getChildHtml('getlowest') ?>

然后就会显示出来,如果我们想在其他页面调用,譬如产品列表页面调用,可以按照下面的方式操作

public function getLowestPrice($_product)
{
$prices = new Mage_Bundle_Block_Catalog_Product_View();
$_tierPrices = $prices->getTierPrices($_product);
$count = $_product->getTierPriceCount();

if ($count > 0):
$i = 0;
$_tierPrices = array_reverse($_tierPrices);

foreach ($_tierPrices as $_price):
if($i==0){
return $_product->getFormatedTierPrice($_price);
$i++;
}
endforeach;
endif;
}

通过这个函数调用就可以得到!

OK,完毕!

0 Comments | Posted in magento原理 By terry water

Magento请求分发与控制器

2011年5月10日星期二 Asia/Shanghai下午10:35:47

Magento请求分发与控制器

Magento使用的是MVC结构,模型-试图-控制器结构,这样更好的实现显示逻辑和数据,业务逻辑的分离,更好的适合开发!

下面为传统的mvc结构

    URL请求被一个PHP文件拦截,这个文件通常称为前端控制器(Front Controller)
    这个PHP文件分析这个URL,获得一个执行控制器(Action Controller)的名字和一个执行方法(Action Method)的名字,这个过程称为路由(Routing)
    实例化#2获得的执行控制器
    调用执行控制器的执行方法
    执行方法中处理业务逻辑,比如获取数据等
    执行控制器负责把数据传递给显示逻辑,用于层面之间数据的交换
    显示逻辑生成HTML,为显示层!

    前端控制器仍然以全局的方式运行
    基于配置的惯例导致了系统不够模块化

        URL Routing不够灵活
        控制器往往和视图绑定
        更改默认设置往往导致大量的重构

Magento的mvc结构略显不同,为下面的方式:

    URL请求被一个PHP拦截
    这个PHP文件实例化一个Magento对象
    Magento对象实例化前端控制器
    前端控制器实例化全局配置中指定的路由对象,可以是多个
    路由对象会逐个与请求URL匹配
    如果发现匹配,那么可以获得一个执行控制器和一个执行方法的名字
    实例化#6获得的执行控制器,并调用相应的执行方法
    执行方法中处理业务逻辑,模型数据
    控制器实例化布局对象(Layout)
    布局对象根据请求的参数,系统配置创建一个块对象(Block)列表,并实例化
    布局对象会调用块对象的output方法生成HTML。这是一个递归的过程,因为块对象可以嵌套块对象
    每一个块对象都和一个模板文件(Template File)对应。块对象包含了显示逻辑,模板文件包含了HTML和PHP输出代码
    块对象直接从模型那里获得数据,换句话说,在Magento的MVC架构中,控制器并不直接把数据传给视图

转载标明出处:magentowater

0 Comments | Posted in magento原理 By terry water
 
  • Mygod Technologies
  • 青岛麦神网络有限公司
  • 香港中路8号
  • 中铁青岛中心大厦A3001
  • 市南区, 青岛, 266000
  • 电话: 0532-5897-3093

订阅我们的最新消息。

我们将严格尊重您的隐私。

关注我们的微信
获取外贸电子商务最新资讯;跨境推广最新策略;电子商务网站技术最新趋势。

2018 Mygod Technologies. 保留所有权. Privacy Policy