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

Maishen technologies

Welcome visitor! You canlogin orcreate an account.

热线:+86-0532-58973093

麦神科技有限公司
Mygod Technologies

官方认证开发工程师

magento--layout里面的标签使用

2011年10月18日星期二 Asia/Shanghai下午12:04:47

在讲解一下magento的标签使用

对于有一些模块,我们在后台的system configuration里面配置了qs_cloudzoom/general/enabled(模块的system.xml文件)

<reference name="product.info">
             <action method="setTemplate" ifconfig="qs_cloudzoom/general/enabled"><template>cloudzoom/catalog/product/view.phtml</template></action>
         </reference>

上面的配置的作用为当qs_cloudzoom/general/enabled设置为enable的时候,那么将product.info这个block的template设置为cloudzoom/catalog/product/view.phtml

0 Comments | Posted in Magento模板 By terry water

如何在magento下面直接操作数据库

2011年10月18日星期二 Asia/Shanghai上午1:38:40

  1. 对于magentp网店,我们有的时候需要链接一下数据库,然后查询或者修改一些数据库的信息来达到我们的意愿,当然对于这个,实现的方法有很多种,下面介绍一种比较简单的方式:
  2. $w = Mage::getSingleton(’core/resource’)->getConnection(’core_write’);  
  3. $result = $w->query(’select ’entity_id’ from ’catalog_product_entity’);  
  4. 看到后,一定要试试,监测一下,然后才能成为你自己的东西!

0 Comments | Posted in magento结构 By terry water

被忽略的seo分页属性:rel=“next” 和 rel=“prev”

2011年10月17日星期一 Asia/Shanghai下午6:24:00

当你的网店的产品很多的时候,就会返回很多页面,被忽略的seo分页属性 rel=“next” 和 rel=“prev”,他能增加网站和谷歌的友好度!

下面是摘:

就像使用 rel=”canonical” 的方式来告诉搜索引擎,重复的内容,我们现在可以使用 HTML 链接元素 rel=“next” 和 rel=“prev”来告诉搜索引擎这些链接“上一页”“下一页”链接的链接关系。

整个网站中,一系列的内容的分页可能会采取多种形状可以分为几个组件页面,或一个产品类别分布在几页的项目,或一个论坛主题分为一个URL序列的文章。现在,如果你选择包括了rel=“next”, rel=“prev”在一系列的分页,页面上写好这样的标记,这样谷歌就会知道这种链接是您网站的分页链接,这样能给谷歌一个良好的印象!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

如果您愿意为您的网站选项3(以上),让我们开始吧!比方说,你的URL分页的内容:

http://www.example.com/article?story=abc&page=1

http://www.example.com/article?story=abc&page=2

http://www.example.com/article?story=abc&page=3

http://www.example.com/article?story=abc&page=4

在第一页,http://www.example.com/article?story=abc&page=1,你<head>部分包括:
<link rel=”next” href=”http://www.example.com/article?story=abc&page=2″

在第二页,http://www.example.com/article?story=abc&page=2:
<link rel=”prev” href=”http://www.example.com/article?story=abc&page=1″
<link rel=”next” href=”http://www.example.com/article?story=abc&page=3″

在第三页,http://www.example.com/article?story=abc&page=3:
<link rel=”prev” href=”http://www.example.com/article?story=abc&page=2″
<link rel=”next” href=”http://www.example.com/article?story=abc&page=4″

并在最后一页上,http://www.example.com/article?story=abc&page=4:
<link rel=”prev” href=”http://www.example.com/article?story=abc&page=3″

增加友好度,方便谷歌更好的抓取和分析您的magneto网站!

0 Comments | Posted in Magento SEO By terry water

从order中得到 Customer 和 Product Info

2011年10月17日星期一 Asia/Shanghai上午10:30:25

当有一个订单order,我们想在中间处理一下,得到customer和product的信息,或者做点别的事情,需要懂之间的关系,下面是一段参考代码,从order中得到 Customer 和 Product Info,大致怎么使用magento的items

   
1 $orderid = "1000000054";
2 $orderid = round(substr($orderid, 1));
3 $order = Mage::getModel('sales/order')->load($orderid);

 

1 <pre>$orderid = "1000000054";
2 $order = Mage::getModel('sales/order')->loadByIncrementId($orderid);</pre>

 

1 $giftMessage = Mage::getModel("giftmessage/message")->load($order->getGiftMessageId());
2 // then use echo $giftMessage->getMessage();
3 $address = trim($order->getShippingAddress()->getFormated(true));
4 // then just echo $address (will give you it formatted with \n separating lines)
5 $items = $order->getAllItems();
6 $total=0;
7 $products = array();
8 foreach ($items as $item) {
9 $products["prod"][] = $item->getProductId();
10 $products["qty"][] = $item->getQtyOrdered();
11 $total += $item->getQtyOrdered();
12 }
13 $total = round($total);
14 // then you have an array of products with id's and corresponding qty's
15 // also echo out the total number of qty's in your order
0 Comments | Posted in magento二次开发 By terry water

magento-怎么判断用户是否登录?

2011年10月17日星期一 Asia/Shanghai上午1:33:46

在一些功能上面,需要对用户进行判断,譬如在页面头部的登录和退出链接,她俩共用一个位置,当用户没有登录的时候显示的登录链接,如果用户已经登录magento网店,那么这个地方显示退出的链接,这样就牵扯到一个用户判断的问题。所以需要代码进行判断magento网店中,用户是否登录

下面是判断的代码

Mage::getSingleton( 'customer/session' )->isLoggedIn();

然后通过if和else做你喜欢做的使用吧!

转载请标注地址!

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

订阅我们的最新消息。

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

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

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