Wednesday, September 25, 2013
[mysql]Managing Hierarchical Data in MySQL
Friday, September 20, 2013
xmlhttprequest
Date:20130921 if (typeof XMLHttpRequest === "undefined") { XMLHttpRequest = function () { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} throw new Error("This browser does not support XMLHttpRequest."); }; } xhr=new XMLHttpRequest(); //xhr.open('GET', 'somepage.xml', true); xhr.open('POST', 'somewhere', true); //xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.onload = function () { // do something to response console.log(this.responseText); }; //xhr.send(null); xhr.send('user=person&pwd=password&organization=place&requiredkey=key'); Reference: http://en.wikipedia.org/wiki/XMLHttpRequest http://www.w3schools.com/xml/xml_http.asp
Wednesday, September 11, 2013
[php]upload file with cross domain
this is the only way I can find to post data with cross domain switch ($_SERVER['HTTP_ORIGIN']) { case 'http://pro.sppp.com': case 'https://pro.sppp.com': header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']); header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS'); header('Access-Control-Max-Age: 1000'); header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With'); break; }
Tuesday, July 16, 2013
[PHP]Zend-Class-Zend_Db_Table_Abstract
Zend_Db_Table_Abstract Methods: Array ( [0] => __construct [1] => setOptions [2] => setDefinition [3] => getDefinition [4] => setDefinitionConfigName [5] => getDefinitionConfigName [6] => setRowClass [7] => getRowClass [8] => setRowsetClass [9] => getRowsetClass [10] => addReference [11] => setReferences [12] => getReference [13] => setDependentTables [14] => getDependentTables [15] => setDefaultSource [16] => getDefaultSource [17] => setDefaultValues [18] => getDefaultValues [19] => setDefaultAdapter [20] => getDefaultAdapter [21] => getAdapter [22] => setDefaultMetadataCache [23] => getDefaultMetadataCache [24] => getMetadataCache [25] => setMetadataCacheInClass [26] => metadataCacheInClass [27] => init [28] => info [29] => select [30] => insert [31] => isIdentity [32] => update [33] => _cascadeUpdate [34] => delete [35] => _cascadeDelete [36] => find [37] => fetchAll [38] => fetchRow [39] => fetchNew [40] => createRow ) consider the above fetchAll() of methods of Zend_Db_Table_Abstract Array ( [0] => __construct [1] => __sleep [2] => __wakeup [3] => init [4] => isConnected [5] => getTable [6] => setTable [7] => getTableClass [8] => rewind [9] => current [10] => key [11] => next [12] => valid [13] => count [14] => seek [15] => offsetExists [16] => offsetGet [17] => offsetSet [18] => offsetUnset [19] => getRow [20] => toArray )
Thursday, July 04, 2013
Learn CSS Positioning in Ten Steps
Tuesday, July 02, 2013
[CSV]escape csv comma and carriage return
2013_07_02 use double quote surround your cell. consider following: ------------------------------ 1.escape carriage return "Cell String" ------------------------------ 2.escape comma "Cell ,String" ------------------------------ 3.escape double quote "Cell ""String" ------------------------------
Wednesday, June 12, 2013
[magento] get class methods for load() of mage::getModel(catelog/product)
$collection = Mage::getModel('catalog/product'); Array ( [0] => getStoreId [1] => getResourceCollection [2] => getUrlModel [3] => validate [4] => getName [5] => getPrice [6] => setPriceCalculation [7] => getTypeId [8] => getStatus [9] => getTypeInstance [10] => setTypeInstance [11] => getLinkInstance [12] => getIdBySku [13] => getCategoryId [14] => getCategory [15] => setCategoryIds [16] => getCategoryIds [17] => getCategoryCollection [18] => getWebsiteIds [19] => getStoreIds [20] => getAttributes [21] => canAffectOptions [22] => cleanCache [23] => getPriceModel [24] => getGroupPrice [25] => getTierPrice [26] => getTierPriceCount [27] => getFormatedTierPrice [28] => getFormatedPrice [29] => setFinalPrice [30] => getFinalPrice [31] => getCalculatedFinalPrice [32] => getMinimalPrice [33] => getSpecialPrice [34] => getSpecialFromDate [35] => getSpecialToDate [36] => getRelatedProducts [37] => getRelatedProductIds [38] => getRelatedProductCollection [39] => getRelatedLinkCollection [40] => getUpSellProducts [41] => getUpSellProductIds [42] => getUpSellProductCollection [43] => getUpSellLinkCollection [44] => getCrossSellProducts [45] => getCrossSellProductIds [46] => getCrossSellProductCollection [47] => getCrossSellLinkCollection [48] => getGroupedLinkCollection [49] => getMediaAttributes [50] => getMediaGalleryImages [51] => addImageToMediaGallery [52] => getMediaConfig [53] => duplicate [54] => isSuperGroup [55] => isSuperConfig [56] => isGrouped [57] => isConfigurable [58] => isSuper [59] => getVisibleInCatalogStatuses [60] => getVisibleStatuses [61] => isVisibleInCatalog [62] => getVisibleInSiteVisibilities [63] => isVisibleInSiteVisibility [64] => isDuplicable [65] => setIsDuplicable [66] => isSalable [67] => isAvailable [68] => getIsSalable [69] => isVirtual [70] => isRecurring [71] => isSaleable [72] => isInStock [73] => getAttributeText [74] => getCustomDesignDate [75] => getProductUrl [76] => getUrlInStore [77] => formatUrlKey [78] => getUrlPath [79] => addAttributeUpdate [80] => toArray [81] => fromArray [82] => loadParentProductIds [83] => delete [84] => getRequestPath [85] => getGiftMessageAvailable [86] => getRatingSummary [87] => isComposite [88] => canConfigure [89] => getSku [90] => getWeight [91] => getOptionInstance [92] => getProductOptionsCollection [93] => addOption [94] => getOptionById [95] => getOptions [96] => getIsVirtual [97] => addCustomOption [98] => setCustomOptions [99] => getCustomOptions [100] => getCustomOption [101] => hasCustomOptions [102] => canBeShowInCategory [103] => getAvailableInCategories [104] => getDefaultAttributeSetId [105] => getImageUrl [106] => getSmallImageUrl [107] => getThumbnailUrl [108] => getReservedAttributes [109] => isReservedAttribute [110] => setOrigData [111] => reset [112] => getCacheIdTags [113] => isProductsHasSku [114] => processBuyRequest [115] => getPreconfiguredValues [116] => prepareCustomOptions [117] => getProductEntitiesInfo [118] => isDisabled [119] => lockAttribute [120] => unlockAttribute [121] => unlockAttributes [122] => getLockedAttributes [123] => hasLockedAttributes [124] => isLockedAttribute [125] => setData [126] => unsetData [127] => loadByAttribute [128] => getStore [129] => getWebsiteStoreIds [130] => setAttributeDefaultValue [131] => getAttributeDefaultValue [132] => setExistsStoreValueFlag [133] => getExistsStoreValueFlag [134] => isDeleteable [135] => setIsDeleteable [136] => isReadonly [137] => setIsReadonly [138] => getIdFieldName [139] => getId [140] => setId [141] => getResourceName [142] => getCollection [143] => load [144] => afterLoad [145] => save [146] => afterCommitCallback [147] => isObjectNew [148] => getCacheTags [149] => cleanModelCache [150] => getResource [151] => getEntityId [152] => clearInstance [153] => __construct [154] => isDeleted [155] => hasDataChanges [156] => setIdFieldName [157] => addData [158] => unsetOldData [159] => getData [160] => setDataUsingMethod [161] => getDataUsingMethod [162] => getDataSetDefault [163] => hasData [164] => __toArray [165] => toXml [166] => toJson [167] => toString [168] => __call [169] => __get [170] => __set [171] => isEmpty [172] => serialize [173] => getOrigData [174] => dataHasChangedFor [175] => setDataChanges [176] => debug [177] => offsetSet [178] => offsetExists [179] => offsetUnset [180] => offsetGet [181] => isDirty [182] => flagDirty ) consider above script $collection = Mage::getModel('catalog/product')->load();//->addAttributeToFilter('sku', array('eq' => 'AKE:ACT336')); print_r(get_class_methods($collection->getPriceModel())); Array ( [0] => getPrice [1] => getBasePrice [2] => getFinalPrice [3] => getChildFinalPrice [4] => getGroupPrice [5] => getTierPrice [6] => getTierPriceCount [7] => getFormatedTierPrice [8] => getFormatedPrice [9] => calculatePrice [10] => calculateSpecialPrice [11] => isTierPriceFixed [12] => isGroupPriceFixed )
Friday, June 07, 2013
[magento] getCollection()-method
grouped_products = Mage::getModel('Catalog/Product')->getCollection();
print_r(get_class_methods($grouped_products)) ;
Array ( [0] => getCatalogPreparedSelect [1] => getPriceExpression [2] => getAdditionalPriceExpression [3] => getCurrencyRate [4] => getFlatHelper [5] => isEnabledFlat [6] => getNewEmptyItem [7] => setEntity [8] => setStore [9] => _loadAttributes [10] => addAttributeToSelect [11] => addIdFilter [12] => addWebsiteNamesToResult [13] => addStoreFilter [14] => addWebsiteFilter [15] => getLimitationFilters [16] => addCategoryFilter [17] => joinMinimalPrice [18] => getMaxAttributeValue [19] => getAttributeValueCountByRange [20] => getAttributeValueCount [21] => getAllAttributeValues [22] => getSelectCountSql [23] => getAllIds [24] => getProductCountSelect [25] => unsProductCountSelect [26] => addCountToCategories [27] => getSetIds [28] => getProductTypeIds [29] => joinUrlRewrite [30] => addUrlRewrite [31] => addMinimalPrice [32] => addFinalPrice [33] => getAllIdsCache [34] => setAllIdsCache [35] => addPriceData [36] => addAttributeToFilter [37] => addTaxPercents [38] => requireTaxPercent [39] => addOptionsToResult [40] => addFilterByRequiredOptions [41] => setVisibility [42] => addAttributeToSort [43] => applyFrontendPriceLimitations [44] => addCategoryIds [45] => addTierPriceData [46] => addPriceDataFieldFilter [47] => clear [48] => setOrder [49] => getMaxPrice [50] => getMinPrice [51] => getPriceStandardDeviation [52] => getPricesCount [53] => setStoreId [54] => getStoreId [55] => getDefaultStoreId [56] => __construct [57] => getTable [58] => getEntity [59] => getResource [60] => setObject [61] => addItem [62] => getAttribute [63] => addFieldToFilter [64] => addEntityTypeToSelect [65] => addStaticField [66] => addExpressionAttributeToSelect [67] => groupByAttribute [68] => joinAttribute [69] => joinField [70] => joinTable [71] => removeAttributeToSelect [72] => setPage [73] => load [74] => getAllIdsSql [75] => save [76] => delete [77] => importFromArray [78] => exportToArray [79] => getRowIdFieldName [80] => setRowIdFieldName [81] => _loadEntities [82] => toArray [83] => getLoadedIds [84] => _prepareSelect [85] => addBindParam [86] => initCache [87] => getIdFieldName [88] => setConnection [89] => getSelect [90] => getConnection [91] => getSize [92] => getSelectSql [93] => addOrder [94] => unshiftOrder [95] => distinct [96] => fetchItem [97] => getData [98] => resetData [99] => loadData [100] => printLogQuery [101] => addFilterToMap [102] => addFilter [103] => getFilter [104] => isLoaded [105] => getCurPage [106] => getLastPageNumber [107] => getPageSize [108] => getFirstItem [109] => getLastItem [110] => getItems [111] => getColumnValues [112] => getItemsByColumnValue [113] => getItemByColumnValue [114] => removeItemByKey [115] => walk [116] => each [117] => setDataToAll [118] => setCurPage [119] => setPageSize [120] => setItemObjectClass [121] => toXml [122] => toOptionArray [123] => toOptionHash [124] => getItemById [125] => getIterator [126] => count [127] => setCacheKey [128] => getCacheKey [129] => setCacheTags [130] => getCacheTags [131] => getCacheLifetime [132] => getFlag [133] => setFlag [134] => hasFlag )
Tuesday, June 04, 2013
[magento] mage class getModel
$grouped_products = Mage::getModel('Catalog/Product')->getCollection()->addAttributeToFilter('visibility', array('eq' => 4)); allfunction $grouped_products: [0] => getCatalogPreparedSelect [1] => getPriceExpression [2] => getAdditionalPriceExpression [3] => getCurrencyRate [4] => getFlatHelper [5] => isEnabledFlat [6] => getNewEmptyItem [7] => setEntity [8] => setStore [9] => _loadAttributes [10] => addAttributeToSelect [11] => addIdFilter [12] => addWebsiteNamesToResult [13] => addStoreFilter [14] => addWebsiteFilter [15] => getLimitationFilters [16] => addCategoryFilter [17] => joinMinimalPrice [18] => getMaxAttributeValue [19] => getAttributeValueCountByRange [20] => getAttributeValueCount [21] => getAllAttributeValues [22] => getSelectCountSql [23] => getAllIds [24] => getProductCountSelect [25] => unsProductCountSelect [26] => addCountToCategories [27] => getSetIds [28] => getProductTypeIds [29] => joinUrlRewrite [30] => addUrlRewrite [31] => addMinimalPrice [32] => addFinalPrice [33] => getAllIdsCache [34] => setAllIdsCache [35] => addPriceData [36] => addAttributeToFilter [37] => addTaxPercents [38] => requireTaxPercent [39] => addOptionsToResult [40] => addFilterByRequiredOptions [41] => setVisibility [42] => addAttributeToSort [43] => applyFrontendPriceLimitations [44] => addCategoryIds [45] => addTierPriceData [46] => addPriceDataFieldFilter [47] => clear [48] => setOrder [49] => getMaxPrice [50] => getMinPrice [51] => getPriceStandardDeviation [52] => getPricesCount [53] => setStoreId [54] => getStoreId [55] => getDefaultStoreId [55] => getDefaultStoreId [56] => __construct [57] => getTable [58] => getEntity [59] => getResource [60] => setObject [61] => addItem [62] => getAttribute [63] => addFieldToFilter [64] => addEntityTypeToSelect [65] => addStaticField [66] => addExpressionAttributeToSelect [67] => groupByAttribute [68] => joinAttribute [69] => joinField [70] => joinTable [71] => removeAttributeToSelect [72] => setPage [73] => load [74] => getAllIdsSql [75] => save [76] => delete [77] => importFromArray [78] => exportToArray [79] => getRowIdFieldName [80] => setRowIdFieldName [81] => _loadEntities [82] => toArray [83] => getLoadedIds [84] => _prepareSelect [85] => addBindParam [86] => initCache [87] => getIdFieldName [88] => setConnection [89] => getSelect [90] => getConnection [91] => getSize [92] => getSelectSql [93] => addOrder [94] => unshiftOrder [95] => distinct [96] => fetchItem [97] => getData [98] => resetData [99] => loadData [100] => printLogQuery [101] => addFilterToMap [102] => addFilter [103] => getFilter [104] => isLoaded [105] => getCurPage [106] => getLastPageNumber [107] => getPageSize [108] => getFirstItem [109] => getLastItem [110] => getItems [111] => getColumnValues [112] => getItemsByColumnValue [113] => getItemByColumnValue [114] => removeItemByKey [115] => walk [116] => each [117] => setDataToAll [118] => setCurPage [119] => setPageSize [120] => setItemObjectClass [121] => toXml [122] => toOptionArray [123] => toOptionHash [124] => getItemById [125] => getIterator [126] => count [127] => setCacheKey [128] => getCacheKey [129] => setCacheTags [130] => getCacheTags [131] => getCacheLifetime [132] => getFlag [133] => setFlag [134] => hasFlag considered above instance.put it in foreach loop like following. foreach($grouped_products as $grouped_product) $grouped_product: [0] => getStoreId [1] => getResourceCollection [2] => getUrlModel [3] => validate [4] => getName [5] => getPrice [6] => setPriceCalculation [7] => getTypeId [8] => getStatus [9] => getTypeInstance [10] => setTypeInstance [11] => getLinkInstance [12] => getIdBySku [13] => getCategoryId [14] => getCategory [15] => setCategoryIds [16] => getCategoryIds [17] => getCategoryCollection [18] => getWebsiteIds [19] => getStoreIds [20] => getAttributes [21] => canAffectOptions [22] => cleanCache [23] => getPriceModel [24] => getGroupPrice [25] => getTierPrice [26] => getTierPriceCount [27] => getFormatedTierPrice [28] => getFormatedPrice [29] => setFinalPrice [30] => getFinalPrice [31] => getCalculatedFinalPrice [32] => getMinimalPrice [33] => getSpecialPrice [34] => getSpecialFromDate [35] => getSpecialToDate [36] => getRelatedProducts [37] => getRelatedProductIds [38] => getRelatedProductCollection [39] => getRelatedLinkCollection [40] => getUpSellProducts [41] => getUpSellProductIds [42] => getUpSellProductCollection [43] => getUpSellLinkCollection [44] => getCrossSellProducts [45] => getCrossSellProductIds [46] => getCrossSellProductCollection [47] => getCrossSellLinkCollection [48] => getGroupedLinkCollection [49] => getMediaAttributes [50] => getMediaGalleryImages [51] => addImageToMediaGallery [52] => getMediaConfig [53] => duplicate [54] => isSuperGroup [55] => isSuperConfig [56] => isGrouped [57] => isConfigurable [58] => isSuper [59] => getVisibleInCatalogStatuses [60] => getVisibleStatuses [61] => isVisibleInCatalog [62] => getVisibleInSiteVisibilities [63] => isVisibleInSiteVisibility [64] => isDuplicable [65] => setIsDuplicable [66] => isSalable [67] => isAvailable [68] => getIsSalable [69] => isVirtual [70] => isRecurring [71] => isSaleable [72] => isInStock [73] => getAttributeText [74] => getCustomDesignDate [75] => getProductUrl [76] => getUrlInStore [77] => formatUrlKey [78] => getUrlPath [79] => addAttributeUpdate [80] => toArray [81] => fromArray [82] => loadParentProductIds [83] => delete [84] => getRequestPath [85] => getGiftMessageAvailable [86] => getRatingSummary [87] => isComposite [88] => canConfigure [89] => getSku [90] => getWeight [91] => getOptionInstance [92] => getProductOptionsCollection [93] => addOption [94] => getOptionById [95] => getOptions [96] => getIsVirtual [97] => addCustomOption [98] => setCustomOptions [99] => getCustomOptions [100] => getCustomOption [101] => hasCustomOptions [102] => canBeShowInCategory [103] => getAvailableInCategories [104] => getDefaultAttributeSetId [105] => getImageUrl [106] => getSmallImageUrl [107] => getThumbnailUrl [108] => getReservedAttributes [109] => isReservedAttribute [110] => setOrigData [111] => reset [112] => getCacheIdTags [113] => isProductsHasSku [114] => processBuyRequest [115] => getPreconfiguredValues [116] => prepareCustomOptions [117] => getProductEntitiesInfo [118] => isDisabled [119] => lockAttribute [120] => unlockAttribute [121] => unlockAttributes [122] => getLockedAttributes [123] => hasLockedAttributes [124] => isLockedAttribute [125] => setData [126] => unsetData [127] => loadByAttribute [128] => getStore [129] => getWebsiteStoreIds [130] => setAttributeDefaultValue [131] => getAttributeDefaultValue [132] => setExistsStoreValueFlag [133] => getExistsStoreValueFlag [134] => isDeleteable [135] => setIsDeleteable [136] => isReadonly [137] => setIsReadonly [138] => getIdFieldName [139] => getId [140] => setId [141] => getResourceName [142] => getCollection [143] => load [144] => afterLoad [145] => save [146] => afterCommitCallback [147] => isObjectNew [148] => getCacheTags [149] => cleanModelCache [150] => getResource [151] => getEntityId [152] => clearInstance [153] => __construct [154] => isDeleted [155] => hasDataChanges [156] => setIdFieldName [157] => addData [158] => unsetOldData [159] => getData [160] => setDataUsingMethod [161] => getDataUsingMethod [162] => getDataSetDefault [163] => hasData [164] => __toArray [165] => toXml [166] => toJson [167] => toString [168] => __call [169] => __get [170] => __set [171] => isEmpty [172] => serialize [173] => getOrigData [174] => dataHasChangedFor [175] => setDataChanges [176] => debug [177] => offsetSet [178] => offsetExists [179] => offsetUnset [180] => offsetGet [181] => isDirty [182] => flagDirty considered above instance.put it in foreach loop like following. $sigle_product_ids = $grouped_product->getTypeInstance(true); $sigle_product_ids: [0] => getRelationInfo [1] => getChildrenIds [2] => getParentIdsByChild [3] => getAssociatedProducts [4] => addStatusFilter [5] => setSaleableStatus [6] => getStatusFilters [7] => getAssociatedProductIds [8] => getAssociatedProductCollection [9] => isSalable [10] => save [11] => getProductsToPurchaseByReqGroups [12] => processBuyRequest [13] => setProduct [14] => setTypeId [15] => getProduct [16] => getSetAttributes [17] => attributesCompare [18] => getEditableAttributes [19] => getAttributeById [20] => isVirtual [21] => processConfiguration [22] => prepareForCartAdvanced [23] => prepareForCart [24] => processFileQueue [25] => addFileQueue [26] => getSpecifyOptionMessage [27] => checkProductBuyState [28] => getOrderOptions [29] => beforeSave [30] => isComposite [31] => canConfigure [32] => canUseQtyDecimals [33] => getSku [34] => getOptionSku [35] => getWeight [36] => hasOptions [37] => updateQtyOption [38] => hasRequiredOptions [39] => getStoreFilter [40] => setStoreFilter [41] => getForceChildItemQtyChanges [42] => prepareQuoteItemQty [43] => assignProductToOption [44] => setConfig [45] => getSearchableData [46] => checkProductConfiguration [47] => isMapEnabledInOptions $products = Mage::getModel('Catalog/Product')->getCollection()->addAttributeToFilter('sku',array('eq',$result_item2['sku'])); foreach($products as $item) { print_r(get_class_methods($item)); } [0] => getStoreId [1] => getResourceCollection [2] => getUrlModel [3] => validate [4] => getName [5] => getPrice [6] => setPriceCalculation [7] => getTypeId [8] => getStatus [9] => getTypeInstance [10] => setTypeInstance [11] => getLinkInstance [12] => getIdBySku [13] => getCategoryId [14] => getCategory [15] => setCategoryIds [16] => getCategoryIds [17] => getCategoryCollection [18] => getWebsiteIds [19] => getStoreIds [20] => getAttributes [21] => canAffectOptions [22] => cleanCache [23] => getPriceModel [24] => getGroupPrice [25] => getTierPrice [26] => getTierPriceCount [27] => getFormatedTierPrice [28] => getFormatedPrice [29] => setFinalPrice [30] => getFinalPrice [31] => getCalculatedFinalPrice [32] => getMinimalPrice [33] => getSpecialPrice [34] => getSpecialFromDate [35] => getSpecialToDate [36] => getRelatedProducts [37] => getRelatedProductIds [38] => getRelatedProductCollection [39] => getRelatedLinkCollection [40] => getUpSellProducts [41] => getUpSellProductIds [42] => getUpSellProductCollection [43] => getUpSellLinkCollection [44] => getCrossSellProducts [45] => getCrossSellProductIds [46] => getCrossSellProductCollection [47] => getCrossSellLinkCollection [48] => getGroupedLinkCollection [49] => getMediaAttributes [50] => getMediaGalleryImages [51] => addImageToMediaGallery [52] => getMediaConfig [53] => duplicate [54] => isSuperGroup [55] => isSuperConfig [56] => isGrouped [57] => isConfigurable [58] => isSuper [59] => getVisibleInCatalogStatuses [60] => getVisibleStatuses [61] => isVisibleInCatalog [62] => getVisibleInSiteVisibilities [63] => isVisibleInSiteVisibility [64] => isDuplicable [65] => setIsDuplicable [66] => isSalable [67] => isAvailable [68] => getIsSalable [69] => isVirtual [70] => isRecurring [71] => isSaleable [72] => isInStock [73] => getAttributeText [74] => getCustomDesignDate [75] => getProductUrl [76] => getUrlInStore [77] => formatUrlKey [78] => getUrlPath [79] => addAttributeUpdate [80] => toArray [81] => fromArray [82] => loadParentProductIds [83] => delete [84] => getRequestPath [85] => getGiftMessageAvailable [86] => getRatingSummary [87] => isComposite [88] => canConfigure [89] => getSku [90] => getWeight [91] => getOptionInstance [92] => getProductOptionsCollection [93] => addOption [94] => getOptionById [95] => getOptions [96] => getIsVirtual [97] => addCustomOption [98] => setCustomOptions [99] => getCustomOptions [100] => getCustomOption [101] => hasCustomOptions [102] => canBeShowInCategory [103] => getAvailableInCategories [104] => getDefaultAttributeSetId [105] => getImageUrl [106] => getSmallImageUrl [107] => getThumbnailUrl [108] => getReservedAttributes [109] => isReservedAttribute [110] => setOrigData [111] => reset [112] => getCacheIdTags [113] => isProductsHasSku [114] => processBuyRequest [115] => getPreconfiguredValues [116] => prepareCustomOptions [117] => getProductEntitiesInfo [118] => isDisabled [119] => lockAttribute [120] => unlockAttribute [121] => unlockAttributes [122] => getLockedAttributes [123] => hasLockedAttributes [124] => isLockedAttribute [125] => setData [126] => unsetData [127] => loadByAttribute [128] => getStore [129] => getWebsiteStoreIds [130] => setAttributeDefaultValue [131] => getAttributeDefaultValue [132] => setExistsStoreValueFlag [133] => getExistsStoreValueFlag [134] => isDeleteable [135] => setIsDeleteable [136] => isReadonly [137] => setIsReadonly [138] => getIdFieldName [139] => getId [140] => setId [141] => getResourceName [142] => getCollection [143] => load [144] => afterLoad [145] => save [146] => afterCommitCallback [147] => isObjectNew [148] => getCacheTags [149] => cleanModelCache [150] => getResource [151] => getEntityId [152] => clearInstance [153] => __construct [154] => isDeleted [155] => hasDataChanges [156] => setIdFieldName [157] => addData [158] => unsetOldData [159] => getData [160] => setDataUsingMethod [161] => getDataUsingMethod [162] => getDataSetDefault [163] => hasData [164] => __toArray [165] => toXml [166] => toJson [167] => toString [168] => __call [169] => __get [170] => __set [171] => isEmpty [172] => serialize [173] => getOrigData [174] => dataHasChangedFor [175] => setDataChanges [176] => debug [177] => offsetSet [178] => offsetExists [179] => offsetUnset [180] => offsetGet [181] => isDirty [182] => flagDirty
[AWS php5-fpm]install php5-fpm ubuntu
- /cgi
- /cli
- /conf.d
- /mods-available
after execute the following code
sudo apt-get install php5-fpm
a new folder named 'fpm' is added
Saturday, June 01, 2013
[magento]manual-Introduction to Magento
初學者翻譯 contact:M9505506@gmail.com
開發者的Magento-第一部分-介紹Magento
什麼是Magento?他是最強的線上電子商務平台並永遠的改變了電子商務的面貌。 當然,妳已經知道了。妳可能沒有發現到Magento也是一個物件導向的PHP framework,他被用來開發現代化、動態的web application....(誇大的形容詞bla~bla~)。
Magento的MVC結構圖 Magento_MVC.pdf
模組內的程式組織
Magento組織他的單一程式成為分別的模組(Module),在一個典型的PHP model-view-Controller (MVC)應用程式中,所有的Controller將會在一個資料夾,所有的model在另一個,諸如此類。在Magento檔案是基於功能性群組在一起的被稱之為Modules. Magento的code。
Magento的程式碼
舉個例子,妳會找到控制器(Controller), 模型(Models), 協助(helpers), 區塊(blocks)等等,與結帳相關的功能在
你會找到Controller, Models, Helpers, Block 等等,與Magento的google結帳功能相關的功能在
你的程式碼
當你想要客製化或是擴展Magento,而不是直接編輯獨立的程式檔,又或甚至配置你新的Controllers, Models, Helpers, Block等到原始Magento code的裡面,你必須創建你自己的Modules
package(也常被稱為 a Namespace)是一個唯一名稱定義了你的公司或是組織名稱,用意是世上每個Mangento的社群成員,為了避免碰撞到其他的使用者的程式,在創建Modules時,都要使用他們自己的Package name
當創建一個新的Model, 你需要去告訴Magneto about it.這是透過新增一個XML檔案到資料夾下去完成的
有兩個種檔案在這個資料夾,首先開啟一個個別的Module,並且命名在下列這個XML表單裡:
Packagename_Modulename.xml
第二點是一個檔案將開啟多模組從一個Package/Namespace,並且被命名在下列的XML表單裡面:
Packagename_All.xml 附註:他只能被核心團隊使用,同Mage_All.xml
不建議啟動多個模組在一個檔案內,這樣會破壞你models的模組化規則。
基於設定檔的MVC架構
Magento是一個基於設定檔(Configuration-Based)的MVC系統,除此之外也是一個基於慣例的(convention-based)MVC系統
在一個基於慣例的系統,假如你想新增一個Controller或是一個新的Model,你只要創建檔案/類別(file/class), 那系統就會自動抓取
在一個基於設定檔的系統,像是Magento,根據新增檔案/類別到程式庫,你經常需要明確的告訴系統關於新的類別或是新的類別群組,在Magento每個模組有一個檔案名為config.xml,這隻檔案包含全部的Magento 模組的相關設定
在執行時,這些檔案會被讀到一個大型的設定樹狀結構。舉個例子來說,想要使用Models 在你自定義的Module?你需要新增一些程式碼到config.xml,用來告訴Magento你要使用Models,就像是你的Modles 應該是有的基礎類別名稱
<models> <packagename> <class>Packagename_Modulename_Model</class> <packagename> </models>
相同的對於Helper, blocks, Routes 和Controller,事件Handlers,與以及其他的。幾乎所有時間你想要塞進系統的,你都需要改變或新增config file
管控者(Controllers)
在php系統,主要的進入點存在一個php的檔案。在magento裡面沒有不同,那隻檔案是index.php。 但你永遠不用編寫index.php。在mvc系統裡,index.php將會包含 程式碼/呼叫 去編寫做到以下項目
- 監控URL
- 基於一系列規則,驅使這些URL進入Contoller的類別與其下一個Action的方法:這動作稱作路由(Routing)
- 重新實體化Controller類別與呼叫Actioin方法()
這些意指任意的進入點在Mangento(或是其他基於MVC架構的系統)是一個在Controll file的一個方法
參考以下的URL
路徑的每個在server name之後的區塊都會被如下的方式解析
前置名稱-catalog(Front name-catalog)
URL的第一部分是被呼叫的front name。這或多或少,告訴magento那一個模組他自己在Controller裡面。在以下的例子,前置名稱就是catalog,他被對應的模組配置
管控者名稱-category(Controller Name-category)
第二部分的URL告訴Magento應該要用的Controller。每一個有Controller的模組有一個特殊的資料夾,名字叫做'controller',它包含了所有,一個模組要用Controllers。以下是一個例子,關於URL部分的cotegory被轉換到Controller file裡面
檔案裡面看起來像這樣:
class Mage_Catalog_CategoryController extends Mage_Core_Controller_Front_Action { }
動作名稱-view(Action Name-view)
第三個在URL的部分是動作名稱。在範例中,這是一個'view'。代表的是被用以創造Action Method。所以再例子'view'將會被送進viewAction
class Mage_Catalog_CategoryController extends Mage_Core_Controller_Front_Action { public function viewAction() { //main entry point } }
Wednesday, May 29, 2013
[javascript] addListener() attachEvent() onmouseover
obj = document.getElementById('aaa') obj.addEventListener('click',function(){alert(2)}) obj.attachEvent('onclick',function(){alert(3)}) obj.addEventListener('mouseover',f1) function f1(){alert(5)} obj_img = document.getElementById('img1') obj_img.addEventListener('mouseover',function(){alert(6)})
aaaaaAAA
aaaaa
.exampleBox { width: 300px; height: 40px; margin: 15px 0 15px 30px; border: 1px solid black; background-color: #cccccc; -moz-box-shadow:inset 0 0 10px white; -webkit-box-shadow:inset 0 0 10px white; box-shadow:inset 0 0 10px white; } .withBackground { background-image: url(http://www.exratione.com/assets/color_background.png); } .block{ position: relative; } .block .info{ position: absolute; left:0px; } .brandimg:hover{ opacity:0.4; } .withOverflowingBackground { position: relative; background-color: transparent; } .withOverflowingBackground::before { content: " "; position: absolute; width: 500px; height: 40px; z-index: -1; background-image: url(http://www.exratione.com/assets/color_background.png); }
Friday, May 17, 2013
[JavaScript]regular expression
RegExp(pattern [, flags]) /pattern/flags
code: var re = new RegExp("\\w+") var re = /\w+/; Properties See also Deprecated RegExp Properties Note that several of the RegExp properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions. constructor Specifies the function that creates an object's prototype. global lastIndex multiline source Methods exec Executes a search for a match in its string parameter. test Tests for a match in its string parameter. toSource Non-standard Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the Object.prototype.toSource method. toString Returns a string representing the specified object. Overrides the Object.prototype.toString method.
Saturday, May 11, 2013
[PHP]SEND JSON HEADER
use this method will be recived like a .json file: header('Content-Type: application/json; charset=utf-8'); use this method will be recived like a .json file: header("Content-type: text/xml; charset=utf-8")
Thursday, May 09, 2013
[PHP]receiving radio box value in php
IN HTML <input class="radio" name="radio" type="radio" value="yes" /> Yes <input class="radio" name="radio" type="radio" value="no" /> No
if (isset($_POST['radio'])) { echo $_POST['radio']; else die("error");
MySQL
use INFORMATION_SCHEMA; select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from KEY_COLUMN_USAGE;