Announcement

Collapse
No announcement yet.

SellerDeck cannot import its own Exported Data

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SellerDeck cannot import its own Exported Data

    The hierarchical file Act_DesignExport.txt that SellerDeck creates during a Partial Site Design export sometimes cannot be imported back into SellerDeck. The fault seems to be with the import routine so this may affect all hierarchical imports.

    DEMONSTRATION: Using SD 16.0.3 demo site (but fails on earlier versions too).

    Duplicate a product layout and call it Buggy Dummy Layout.
    Open Buggy Dummy Layout and paste in the following sample code;
    Code:
    <div style="padding: 10px 0; width: 1008px; margin: 0 auto;">
    			
    <!-- Google Code for Purchased Conversion Page -->
    
    <noscript>
    <div style="display:inline;">
    <img height="1" width="1" style="border-style:none;" alt="" src="dummy"/>
    </div>
    </noscript>
    </div>
    
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsNotPreviewMode%22%20%2f%3e" >
    	<script type="text/javascript">
    		<actinic:block if="%3cactinic%3avariable%20name%3d%22BazaarVoiceTestMode%22%20%2f%3e" >
    			// test code
    			function trackTransactionPageView(obj){
    				var txt = "ID:" + obj.orderId 
    					+ "\x0d\x0aTAX:" + obj.tax 
    					+ "\x0d\x0aSHIP:" + obj.shipping 
    					+ "\x0d\x0aTOT:" + obj.total 
    					+ "\x0d\x0aCOUNTRY:" + obj.country 
    					+ "\x0d\x0aEMAIL:" + obj.email 
    					+ "\x0d\x0aNICK:" + obj.nickname; 
    				for (var i=0; i<prodlines.length; i++)
    					{
    					txt += "\x0d\x0a\x0d\x0aLINE " + (i+1) 
    						+ "\x0d\x0aSKU:" + obj.items[i].sku
    						+ "\x0d\x0aNAME:" + obj.items[i].name 
    						+ "\x0d\x0aCAT:" + obj.items[i].category 
    						+ "\x0d\x0aQTY:" + obj.items[i].quantity 
    						+ "\x0d\x0aUNIT:" + obj.items[i].price;
    					}
    				alert(txt);	
    			}
    		</actinic:block>
    		
    		var prodlines = new Array();
    		
    		function bv_numberonly(num){	// return numeric bit of £1,234.56 type string
    			return num.replace(/[^0-9.]/g, '');
    		}
    		
    		function bv_fixspaces(txt){	// replace &nbsp; with normal space
    			return txt.replace(/&nbsp;/g, ' ');
    		}
    		
    		function bv_striptags(txt){	// strip HTML tags
    			return txt.replace(/<.*?>/g,'');
    		}
    		
    		function bv_unescape(txt){	// remove SD escaping
    			return txt.replace(/&#(\d+);/g, function(m,s){return String.fromCharCode(s - 0)});
    		}
    		
    		function bv_cleanemail(email){ // clean email address
    			return bv_unescape(bv_striptags(email.replace(/Email:&nbsp;/ig, '')));	// remove extraneous text
    		}
    		
    		function bv_reportOrder(){
    			// collect product lines
    			$('.prodlinerow').each(function(){
    				var ref = $('.cartprodref:first', this).text().replace(/\//g, '-');
    				var name = $('.cartprodname:first', this).text();
    				var qty = $('.cartprodqty:first', this).text();
    				var unitprice = bv_numberonly($('.prodlineunitprice:first', this).text());
    				prodlines.push({
    					// NB tabs before commas needed to fix SD Act_DesignExport bug
    					"sku" : ref,
    					"name" : name,
    					"category" : "aw",
    					"price" : unitprice,
    					"quantity" : qty});
    				});
    			// send details
    	</script>
    </actinic:block>
    Do Design / Export Specific Design Elements and create a Partial Site Design called buggydummylayout.acd containing just the single layout Buggy Dummy Layout from above.

    Now do File / Import / Hierarchical Import / Update and choose "Act_DesignExport.txt" from your Site folder (this was created when doing the PSD above) / say next to everything else and choose a file for reporting errors.

    You should see an error:
    Code:
    Line 231: Data type error. The field Markup Type was given \r\n					""price"" : unitprice when it expected an integer.
    Now Act_DesignExport.txt was just created by SellerDeck when doing the Partial Site Design so should be problem free but isn't.

    The bug seems to be on the import as the exported file looks OK.

    WORKAROUND

    Edit layout Buggy Dummy Layout and look near the bottom for the following code:
    Code:
    					"category" : "aw",
    Edit the above to put a tab before the comma (code is syntactically the same after doing this):
    Code:
    					"category" : "aw" ,
    Repeat creating the Partial Site Design as above and then re-import the fresh Act_DesignExport.txt and voila - no errors!

    It looks like the Hierarchical import sometimes cannot deal with a line ending in ", when importing. This seems to be dependent on the size of the code as removing lines near the top of the above layout sometimes clears the problem.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey
Working...
X