RealTimeDesigner Support Network
Wiki Forums Libraries Docs Support RealTimeDesigner Home

RealTimeDesigner WIKI

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorials:magento [2012/02/17 14:04]
mark [Pushing the RTD Design to Magento Cart]
tutorials:magento [2012/02/18 08:18] (current)
mark [Design It Now Button]
Line 1: Line 1:
-===== Magento Cart iwth RealTimeDesigner =====+===== Magento Cart with RealTimeDesigner =====
  Magento Cart is a very adaptable, open source ecommerce shopping cart platform that is widely used and well supported by a large community.  Magento is especially adapted to an ecommerce site with a large array of products.  Magento is written in PHP language and uses MYSQL database, the same platform as RTD itself. \\  Magento Cart is a very adaptable, open source ecommerce shopping cart platform that is widely used and well supported by a large community.  Magento is especially adapted to an ecommerce site with a large array of products.  Magento is written in PHP language and uses MYSQL database, the same platform as RTD itself. \\
 \\ \\
Line 16: Line 16:
  
 ==== Design It Now Button ==== ==== Design It Now Button ====
- The first step to combining Magento and RTD is to insert a "Design It Now" button within your magento site.  While this could be done by inserting a button image and HTML links for the RTD directly into your Magento product descriptions, we chose a bit more complicated method that creates a live link to your RTD products so that rather than manually copying and pasting the links, you can simply pick the product from dropdown list and the link is grabbed via the RTD API. Our site contained an extensive array of products.  A little bit more work up front means considerable time savings down the roadIf your Magento product offering will be limitedperhaps the simpler,  + The first step to combining Magento and RTD is to insert a "Design It Now" button within your magento site.  The simplest way to do this is to insert a button image and HTML link for the RTD directly into your Magento product description. Because our site would have a large array of products, we chose a bit more complicated method that involves creating to attributes in magento.  One attribute determines whether the product will be "design online" type of product.  The second attribute contains the external link for that product into RTD.  This standardized our site so that the Design It Now button always appeared in the same locationDetails for our method are below:\\ 
-manual link placement will be fine. Details for our method are here:+\\ 
 +In Magento backendcreate an Attribute Set for the special product type. Name the attribute set “Product Design Required”. Nextcreate 2 attributes as shown:  
 +**Catalog > Manage Attributes > Add New Attribute**  
 +== Attribute one: == 
 +  * Attribute name : Show “Design Online” button 
 +  * Attribute code: launchdesign 
 +  * Scope: Global 
 +  * Catalog Input Type for Store: Yes/No 
 +  * Values Required: Yes 
 +  * Visible on Product View Page on Front-end: Yes 
 +  * Used in Product Listing: Yes 
 +== Attribute two: == 
 +  * Attribute name : Design Link 
 +  * Attribute code: design_link 
 +  * Scope: Global 
 +  * Catalog Input Type for Store: Text Field 
 +  * Values Required: No 
 +  * Visible on Product View Page on Front-end: Yes 
 +  * Used in Product Listing: Yes 
 +Assign these attributes to Attribute Set. Now when you create new products, the attributes will be available for all products.
  
 ==== Pushing the RTD Design to Magento Cart ==== ==== Pushing the RTD Design to Magento Cart ====
Line 34: Line 53:
 $ FIELD_VALUE_NAME = $ _REQUEST ['FIELD_VALUE'];\\ $ FIELD_VALUE_NAME = $ _REQUEST ['FIELD_VALUE'];\\
 FIELD_VALUE which is the value from the configuration allows setting by administrator of designer site. FIELD_VALUE which is the value from the configuration allows setting by administrator of designer site.
-These variables are named or defined in the admin.+These variables are named or defined in the admin.\\ 
 +\\ 
 +2. After getting this information product, an important task that I will find out in-store 
 +product Magento . If Magento store this product does not exist, the page processor will take 
 +us back to the designer site.\\ 
 +\\ 
 +I can only search for products by name:\\ 
 +Line 48 (Processing.php)\\ 
 +/ * get product name from URL * / \\ 
 +$ p_name_1 = $ _REQUEST ['p_name_1'];\\ 
 +\\ 
 +And below this line you will find my way to connect to the database of Magento.\\ 
 +\\ 
 +$ connection = Mage:: getSingleton ('core / resource') -> getConnection ("core_read");\\ 
 +$ query = 'SELECT\\ 
 +entity_id\\ 
 +FROM\\ 
 +catalog_product_entity_varchar\\ 
 +JOIN ON eav_attribute catalog_product_entity_varchar.attribute_id = eav_attribute.attribute_id\\ 
 +WHERE\\ 
 +catalog_product_entity_varchar.entity_type_id = 4 AND\\ 
 +eav_attribute.attribute_code = "name" AND\\ 
 +catalog_product_entity_varchar.value = "'. $ p_name_1 .'";';\\ 
 +$ result = $ connection-> fetchAll ($ query);\\ 
 +$ product_id = $ result [0] ['entity_id'];\\ 
 +\\ 
 +catalog_product_entity_varchar.entity_type_id = 4 is default product type. You should not change anything. Keep my code and change the name of variables. \\ 
 +\\ 
 +MYSQL query on the following command, if the product exists, you get the product_id to update prices for products and information of the product to cart. Update prices and other 
 +information is updated via a product option in Magento site, this option was named DESIGN DETAILS.\\ 
 +\\ 
 +DESIGN DETAILS is textarea type , It will contain information of the product to store in the shopping cart and the price of the product from the designer site will be updated through this option.\\ 
 +Rates are calculated as shown below:\\ 
 +\\ 
 +/ * UPDATE FOR OPTION PRICE OF PRODUCT IN Magento * /\\ 
 +$ p_total_price_1 = $ _REQUEST ['p_total_price_1'];\\ 
 +$ qty_1 = $ _REQUEST ['qty_1'];\\ 
 +$ price_option = $ p_total_price_1 / $ qty_1;\\ 
 +$ price_option = round ($ price_option, 4);\\ 
 +$ connection2 = Mage:: getSingleton ('core / resource') -> getConnection ("core_write");\\ 
 +$ query2 = 'UPDATE SET catalog_product_option_price catalog_product_option_price.price = "'. $\\ 
 +price_option. '" WHERE catalog_product_option_price.option_id = "282"';\\ 
 +Product’s option id.\\ 
 +$ result2 = $ connection2-> query ($ query2);\\ 
 +\\ 
 +The values are taken from the site designer you can find from line 78 to line 282.\\ 
 +\\ 
 +Next, we will group the information into a text to assign this variable value option for newly updated. From line 284.\\ 
 +/ * START * All Fields MERGE /\\ 
 +$ opt =' ';\\ 
 +\\ 
 +Line 404 to remove the special characters, such characters will break the link information when updating the product to cart via URL\\ 
 +\\ 
 +$ options = str_replace ('&','+',$ opt);\\ 
 +\\ 
 +From 405 lines to 420 lines as I do get the address of the site links magento.\\ 
 +\\ 
 +Finally, if the product is found, meaning the results to search queries product_id, the page will be redirected to the Magento shopping cart site.\\ 
 +\\ 
 +example:\\ 
 +I find products id = 275. The link to the shopping cart will have the following syntax:\\ 
 +checkout / cart / add? product = 275 & qty = 1 & options [282] = 'Text value of product design'\\ 
 +\\ 
 +In general:\\ 
 +\\ 
 +if ($ product_id !='') {?>\\ 
 +<script>\\ 
 +parent.location = ('<? php echo $ ur;?> / checkout / cart / add? product = <? php echo $ product_id;?> & qty = <? php echo $ _qty;?> & options [282] = <? php echo $ options;?>');\\ 
 +</ script>\\ 
 +\\ 
 +If product not found on Magento site, user will be directed back to designer site.\\ 
 +\\ 
 +<script>alert("This product has expired OR We have no one.Please try again!");\\ 
 +history.go(-1);\\ 
 +</script>\\ 
 +\\ 
 +Note\\ 
 ==== User Login ==== ==== User Login ====
  The procedures above are adequate to complete RTD online design through Magento but does not address the issues encountered by Registered Users. If you have disabled this feature, nothing more is needed.  If you desire to use the Registerred Users features of the RTD and Magento you should consider linking the login info for both.  This gives returning visitors the ability to see what they bought before and recall previous designs.  Without linking the logins, your users will be faced with a seperate login for each system which may prove clumbsy.  To create the link for user logins you will need to install the following script.  Be sure to edit the login credentials coded into the file to correspond with your RTD account.  The procedures above are adequate to complete RTD online design through Magento but does not address the issues encountered by Registered Users. If you have disabled this feature, nothing more is needed.  If you desire to use the Registerred Users features of the RTD and Magento you should consider linking the login info for both.  This gives returning visitors the ability to see what they bought before and recall previous designs.  Without linking the logins, your users will be faced with a seperate login for each system which may prove clumbsy.  To create the link for user logins you will need to install the following script.  Be sure to edit the login credentials coded into the file to correspond with your RTD account.