于洋博客 互联网点滴记忆

24Nov/103

用NoFollow的博客回复做SEO是否依然有效

2005年GoogleBlog发布了一篇关于NoFollow的帖子
http://googleblog.blogspot.com/2005/01/preventing-comment-spam.html

按照字面上的说法:“From now on, when Google sees the attribute (rel="nofollow") on hyperlinks, those links won't get any credit when we rank websites in our search results.”,从这一刻起,当Google在链接上看到这个属性(rel="nofollow"),这些链接所在的网站在被评级时,不会从该链接得到任何好处。主流的Blog托管商及商业软件如LiveJournal, Blogger, WordPress均对Comment做了NoFollow处理,其他小软件商也闻风而动,最后随着其他搜索引擎巨头的跟进,实质上宣告了用博客回复做SEO的死刑。

然而5年多过去了,如果你也拥有一个独立博客的话,你一定不会对后台堆积如山的垃圾评论陌生。依然有大量的人采用这种方式进行着推广。

是他们不知道这样做无效,还是,他们坚信这样做依然有效?

Filed under: SEO 3 Comments
24Nov/100

用Mysql存储过程为Magento批量添加Upsell和Crosssell

delimiter //
TRUNCATE catalog_product_link;//
TRUNCATE catalog_product_link_attribute_int;//
drop procedure test//

create procedure test(p_sku varchar(255))
BEGIN
DECLARE v_entity_id INT;
DECLARE loop_entity_id INT;
DECLARE v_link_id INT;

SELECT entity_id INTO v_entity_id FROM catalog_product_entity WHERE sku = p_sku;
select v_entity_id;

BEGIN
  DECLARE C1 CURSOR FOR
  SELECT entity_id FROM catalog_product_entity;
  OPEN C1;
  LOOP
  FETCH C1 INTO loop_entity_id;
    INSERT INTO catalog_product_link (product_id, linked_product_id, link_type_id) VALUES
    (loop_entity_id, v_entity_id, 5);
    SELECT MAX(link_id) INTO v_link_id FROM catalog_product_link;
    select v_link_id;
   
    INSERT INTO catalog_product_link_attribute_int (product_link_attribute_id, link_id, value) VALUES
    (4, v_link_id, 0);

    INSERT INTO catalog_product_link (product_id, linked_product_id, link_type_id) VALUES
    (loop_entity_id, v_entity_id, 4);
    SELECT MAX(link_id) INTO v_link_id FROM catalog_product_link;
    select v_link_id;
   
    INSERT INTO catalog_product_link_attribute_int (product_link_attribute_id, link_id, value) VALUES
    (3, v_link_id, 0);

  END LOOP;
  CLOSE C1;
END;
END;//

call test('W7UK')//
call test('W7EK')//
call test('W7HPK')//
call test('W7HBK')//
call test('W7PK')//
call test('W7SK')//
call test('OP2010K')//
call test('OPP2010K')//
call test('OS2010K')//
call test('OHS2010K')//
call test('OHB2010K')//
call test('OE2007K')//
call test('OU2007K')//
call test('OPP2007K')//
call test('OP2007K')//
call test('OS2007K')//
call test('OVP2010K')//
call test('OVPM2010K')//
call test('OVS2010K')//
call test('OPJP2010K')//
call test('OPJS2010K')//
call test('OVP2007K')//
call test('OVS2007K')//
call test('OPJP2007K')//
call test('OPJS2007K')//

Filed under: Lamp, Magento No Comments
23Nov/100

用Mysql存储过程为Magento批量添加Custom Options

最近做一批站群,有几十个网站需要对产品设置Custom Options,手工勾选效率既低又易出错,编写如下存储过程完成

delimiter //
TRUNCATE catalog_product_option;//
TRUNCATE catalog_product_option_title;//
TRUNCATE catalog_product_option_type_value;//
TRUNCATE catalog_product_option_type_price;//
TRUNCATE catalog_product_option_type_title;//

drop procedure test//
create procedure test(p_sku varchar(255))
BEGIN

DECLARE v_entity_id INT;
DECLARE v_option_id INT;
DECLARE v_option_type_id INT;
DECLARE v_option_type_id2 INT;
SELECT entity_id INTO v_entity_id FROM catalog_product_entity WHERE sku = p_sku;
select v_entity_id;

INSERT INTO catalog_product_option (product_id, type, is_require, sku, max_characters, file_extension, image_size_x, image_size_y, sort_order) VALUES
(v_entity_id, 'checkbox', 0, '', NULL, NULL, 0, 0, 0);

SELECT option_id INTO v_option_id FROM catalog_product_option WHERE product_id = v_entity_id;
select v_option_id;

INSERT INTO catalog_product_option_title (option_id, store_id, title) VALUES
(v_option_id, 0, 'USB Installer');

INSERT INTO catalog_product_option_type_value (option_id, sku, sort_order) VALUES
(v_option_id, 'USB32B', 0),
(v_option_id, 'USB64B', 0);

SELECT max(option_type_id) INTO v_option_type_id FROM catalog_product_option_type_value;
select v_option_type_id;

SET v_option_type_id2 = v_option_type_id -1;

INSERT INTO catalog_product_option_type_price (option_type_id, store_id, price, price_type) VALUES
(v_option_type_id2, 0, '39.9900', 'fixed'),
(v_option_type_id, 0, '39.9900', 'fixed');

INSERT INTO catalog_product_option_type_title (option_type_id, store_id, title) VALUES
(v_option_type_id2, 0, '32BIT 4GB Installtion System USB Disk'),
(v_option_type_id, 0, '64BIT 4GB Installtion System USB Disk');

UPDATE catalog_product_entity SET has_options = '1' WHERE catalog_product_entity.entity_id =v_entity_id;

END;//

然后根据产品SKU批量执行即可

call test('W7UK')//
call test('W7EK')//
call test('W7HPK')//
call test('W7HBK')//
call test('W7PK')//
call test('W7SK')//
call test('OP2010K')//
call test('OPP2010K')//
call test('OS2010K')//
call test('OHS2010K')//
call test('OHB2010K')//
call test('OE2007K')//
call test('OU2007K')//
call test('OPP2007K')//
call test('OP2007K')//
call test('OS2007K')//
call test('OA2010K')//
call test('OE2010K')//
call test('OI2010K')//
call test('OW2010K')//
call test('OPPT2010K')//
call test('OO2010K')//
call test('OON2010K')//
call test('OPB2010K')//
call test('OA2007K')//
call test('OG2007K')//
call test('OI2007K')//
call test('OON2007K')//
call test('OO2007K')//
call test('OPB2007K')//
call test('OSD2007K')//
call test('OVP2010K')//
call test('OVPM2010K')//
call test('OVS2010K')//
call test('OPJP2010K')//
call test('OPJS2010K')//
call test('OVP2007K')//
call test('OVS2007K')//
call test('OPJP2007K')//
call test('OPJS2007K')//
call test('WVBK')//
call test('WVEK')//
call test('WVHBK')//
call test('WVHPK')//
call test('WVUK')//
call test('WXHEWSP3K')//
call test('WXMCK')//
call test('WXPK')//
call test('WXPIEK')//
call test('WXPWSP3K')//

Filed under: Lamp, Magento No Comments
16Nov/100

SENuke Google账户需人工验证

Google Account issue:

Problem: Google Account requires verification

Solution: Create a google account manually and follow the steps to verify it. There's really no way of getting around this.

使用了付费的美国动态ADSL VPN用SENuke注册Google账户(用于Blog Spot)注册完毕后提示手机短信验证,猜测可能是该付费VPN被多人使用过,对应的策略是手工注册,清理机器缓存,并尝试更多代理。

Filed under: SENuke No Comments
3Nov/102

重置Magento管理员密码

如果不小心忘记了Magento的管理员密码可以通过如下SQL语句:

SELECT * FROM admin_user;

通过这个语句找到管理员的账户名称,比如admin

再利用如下语句更新其密码:

UPDATE admin_user SET password=CONCAT(MD5('YYpassword'), ':YY') WHERE username='admin';

前两个字母‘YY’可以换成任何其他字符,真正的密码是password这段,执行后,你就可以用新密码password登录了。

Filed under: Magento 2 Comments
3Nov/100

Magento为什么这么慢

打印下$this就知道了。输出了27万行之后脚本超时了,我不知道后面还会有多少行输出。

Filed under: Magento No Comments
2Nov/100

晒被子计

昨天天气不错,于洋把被子晒了出去,想着晚上可以盖着暖和的被子,于洋感觉很幸福,工作到次日凌晨5点瞌睡了想回去睡觉了,于洋才惊觉被子忘记收了,看着窗外11月雾冷蒙蒙的夜,于洋感觉相当失落。

2Nov/101

Magento去除分类页.html后缀提高SEO权重

一般的理论认为,形如http://www.yuyangblog.com/magento的页面会被认为是目录,会比形如http://www.yuyangblog.com/magento.html的页面的权重要高,因此需要在Magento站点设置的时候把分类的.html后缀去掉。

具体方法如下:

System->Configuration->Catalog:

Search Engine Optimizations区块下

更新完毕后需要重建索引更新缓存。

在同样的位置上方的地方是修改产品后缀的地方,不建议删除,因为过多的产品页会分散分类页面的权重。

Filed under: Magento, SEO 1 Comment