Month: March 2016

MySQL: 获取表结构 Get a MySQL table structure with DESCRIBE

Example table The example table used in this post was created with the following SQL: CREATE TABLE `products` ( `product_id` int(10) unsigned NOT NULL auto_increment, `url` varchar(100) NOT NULL, `name` varchar(50) NOT NULL, `description` varchar(255) NOT NULL, `price` decimal(10,2) NOT NULL, `visible` tinyint(1) unsigned NOT NULL default '1', PR… Read More

Magento: 代替flash上传 How to disable Flash uploader in Magento (product images and WYSIWYG)

1. 替换产品页flash上传按钮 – 使用 Dull_Uploader How to disable Flash uploader in Magento 1.4.x – 1.9.x So what to do if one day you will discover that you simply cannot upload any images in your Magento administration panel due to Flash problem? Don’t panic, just follow these simple steps: 1. Find the Dull_Uploader (No Flash Image Uploader) module…

jQuery Zoom 图片聚焦或者点击放大A plugin to enlarge images on touch, click, or mouseover

下载: zoom-master 项目地址: https://github.com/jackmoore/zoom Compatible with: jQuery 1.7+ in Chrome, Firefox, Safari, Opera, Internet Explorer 7+. Install via NPM npm install jquery-zoom Instructions Zoom appends html inside the element it is assigned to, so that element has to be able to accept html, like <a>, <span>, <li>, <div… Read More

Bootstrap 3 : 侧边菜单插件 Sliding Side Menu/Panel with jQuery and Bootstrap – BootSideMenu

A simple lightweight javascript plugin used to create side menus/panels that smoothly slide out from the edge of your screen when toggled, built with jQuery and Bootstrap 3. How to use it: 1. Load the Bootstrap’s stylesheet and BootSideMenu.css in the head section of the web page. <link rel="stylesheet" href="//netdna.bootstrapcdn.com/boo… Read More

同一表单内设置两个或两个以上的提交按钮 Two submit buttons in one form

给相同 name就可以了, 类似radio的和checkbox的用法: You can give each input a different value and keep the same name: <input type="submit" name="action" value="Submit" /> <input type="submit" name="action" value="Update" /> <input type="submit" name="action" value="Delete" /> php接收: Then in the code check to see which was triggered: if ($_… Read More

Magento: 在客户账户中添加自定义链接 My Account Add Link

This extension add new link and a page to that link and enable/disable links in my account left Nav section. 页面: https://www.magentocommerce.com/magento-connect/my-account-add-link.html Magento Connect 2.0 : http://connect20.magentocommerce.com/community/ng_customer 下载:  ng_customer-1.0.2—-customer-account-page   本文: M… Read More

悼念程序员的那些难忘时刻 漫画组图(一)

作为程序员,我们经历过多少风风雨雨,久经沙场,总有一些让人难忘、让人回味的时刻,本系列文章旨在帮你回忆起那些难忘精彩或者悲催的时刻,让我们一起来悼念! 1、你身边的人总是把你当成修电脑的 事实上:我只是大部分时间在Google上搜索问题而已。 2、突然你代码写不下去了…但发现Stack Overflow却挂了 3、当你误改了一行代码 4、当你尝试修复一个bug的时候 5、终端用户不知道该如何使用你开发的软件 6、关键问题是…你不能复制代码 7、星期五下午项目经理给你分配任务的时候 8、上线前可以在这里添加一个按钮吗? 9、你的代码看起来一团糟,让我来重构它 10、当你尝试修复别人某些代码的时候 恭喜你,现在成了你的问题… Read More

Magento: 根据产品属性加载产品信息 Load A Category or Product by an Attribute

Load a Product by ID <?php // get product model by product id, assuming you have known product id, $productId $_product = Mage::getModel('catalog/product')->load($productId) Load a Product by SKU <?php $sku = 'my-product-sku'; $product = Mage::getModel('catalog/product')->load($sku, 'sku'); if ($product->getId()) { echo $pr… Read More

Magento模块开发之数据库SQL操作方法说明

今天主要来看Magento中的Mysql4/Resource(资源) 如何对数据库进行操作, 来执行更为复杂的 sql 语句。 在Magento中Model 通常都会继承 Mage_Core_Model_Abstract, 而这个 Abstract 又继承了Varien_Object, 在 Abstract 类中包含许多常用的方法,例如: getId(), load(), save(), delete() 等等…而 Mysql4/Resource Model 则继承 Mage_Core_Model_Mysql4_Abstract, 而这个 Abstract 又继承了 Mage_Core_Model_Resource_Abstract SQL 和 My… Read More

git reset, git checkout, git revert 区别 (译)

题记:团队中大多数成员使用 sourceTree 和 github 两款 git 工具,然而大家对于图形化工具提供的 reset,checkout,revert 功能点并不是很了解,甚至于混淆,然后凭借猜测去使用。功夫不负有心人,在尝试过多次冲突处理或分支开发的坑后,终于形成了自己的一套使用方式,可喜可 贺。然而问题的解决方案的并不是效率最高的,内部的执行过程我们也不清楚,这对于一个自律的程序艺术家是无法接受的。基于这个问题,翻译这篇博客,为 git 中高级用户的 undo 操作提供参考。鼓励在熟悉命令行操作再通过图形化工具提高开发效率。水平有限,释疑为主,翻译为辅 Reset Checkout and Revert 原文地址:… Read More