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

Maishen technologies

Welcome visitor! You canlogin orcreate an account.

热线:+86-0532-58973093

麦神科技有限公司
Mygod Technologies

官方认证开发工程师

magento中customer,得到id,email

2012年6月25日星期一 Asia/Shanghai下午2:20:02

1.

通过email得到id的快速方法

$customer = Mage::getModel('customer/customer');
            $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
            $customer->loadByEmail("[email protected]");
            //var_dump($customer);
            
             $customerId = $customer->getEntityId();

customerId就是我们通过email、想要得到的id的值

2

通过id得到email,

$customer = Mage::getModel('customer/customer')->load(1);
$customerFirstName = $customer->getFirstname();
$customerEmail = $customer->getEmail();

OK!通过上面的函数可以快速的得到您想要的客户的属性的值!
0 Comments | Posted in Magento开发 By terry water

magento网店产品不能加入购物车的原因

2012年6月23日星期六 Asia/Shanghai上午10:45:22

有的时候我们把产品加入到购物车的时候会报错:can not add to cart

原因有很多种,只能遇到后自己处理,然后积累出来可能那里出现问题

下面是我遇到的一种不能加入购物车的原因:

我安装magento的时候把session安装到文件中

然后在linux下session这个文件夹没有可写权限

进入造成加入购物车的时候,magento不能生成session文件

进而造成产品不能加入购物车的现象!

OK!

0 Comments | Posted By terry water

在支付页面的底部的订单详情中添加产品图片

2012年6月22日星期五 Asia/Shanghai上午9:09:28

magento的订单页面的最后一步,显示的订单的详情,只显示了产品名字,价格,等3-4个选项,现在我们希望把产品图片显示出来!

步骤如下:

1.

frontend/{your_theme}/decault/template/checkout/onepage/review/info.phtml

找到代码

 <table class="data-table" id="checkout-review-table">
   
<?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
   
<col />
   
<col width="1" />
   
<col width="1" />
   
<col width="1" />
   
<col width="1" /> <
加入一个新行
2.
下面加入产品图片的列
  <thead>
       
<tr>
            <th rowspan="
<?php echo $rowspan ?>">&nbsp;</th> <!-- Here's the empty col for the image -->
            <th rowspan="
<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
            <th colspan="
<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
3
frontend/{your_theme}/decault/template/checkout/onepage/review/item.phtml

<?php $_item = $this->getItem()?>
<tr>
    <!-- Product Image Here -->
    <td><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /
></td>
   
<td><h3 class="product-name"><?php echo $this->htmlEscape($this->getProductName()) ?></h3>
加到想要显示的地方就可以了!!
然后在支付页面的底部的订单详情中就会显示出来产品图片!
0 Comments | Posted in magneto学习 By terry water

在购物车页面显示产品的sku

2012年6月21日星期四 Asia/Shanghai下午7:08:43

在购物车页面显示产品的sku,详细的代码如下:

<div>

SKU:

<?php

if (is_object($this->getChildProduct())):    

        echo $this->getChildProduct()->getSku(); 

      else:      

      echo $_item->getSku();     

endif; ?>

</div>

把上面的代码加到app\design\frontend\default\default\template\checkout\cart\item\default.phtml

找到你想显示的地方加进去就行了!

0 Comments | Posted in magento日常所用 By terry water

jquery如何操作带有冒号的id

2012年6月20日星期三 Asia/Shanghai下午5:02:52

 

css除了正规的,也是可以带有冒号和点号的--   :.

在jquery操作的时候,直接操作,譬如如下:

jQuery("#shipping:firstname").val();

取到的值是undefined。

对于这种css中的id,需要使用转义:

如下:

 // Does not work
 $("#some:id")
 
 // Works!
 $("#some\\:id")
 // Does not work
 $("#some.id")
 
 // Works!
 $("#some\\.id")

 

下面是个转义的js函数,直接使用就行!然后进行操作!

 function jq(myid) { 
   return '#' + myid.replace(/(:|\.)/g,'\\$1');
 }
使用:
 $( jq('some.id') )


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

订阅我们的最新消息。

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

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

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