Subversion Repositories cheapmusic

Rev

Rev 23 | Rev 38 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23 Rev 24
Line 63... Line 63...
63
 
63
 
64
// Check to see if the request found any results
64
// Check to see if the request found any results
65
	if (isset($result->TotalMatches)) {
65
	if (isset($result->TotalMatches)) {
66
  // If the response was loaded, parse it and store in array
66
  // If the response was loaded, parse it and store in array
67
		foreach ($result->item as $item) {
67
		foreach ($result->item as $item) {
68
 
-
 
69
 
-
 
70
 
-
 
71
			$merchantId = strval($item->mid);
68
			$merchantId = strval($item->mid);
72
			$merchantName = (string)$item->merchantname;
69
			$merchantName = (string)$item->merchantname;
73
			$barcode = (string)$item->upccode;
70
			$barcode = (string)$item->upccode;
74
			$barcodeType = clsLibGTIN::GTINCheck($barcode, false, 1);
71
			$barcodeType = clsLibGTIN::GTINCheck($barcode, false, 1);
75
 
72
 
76
            // approved: SamAsh, alibris
-
 
77
            
-
 
78
			$title = (string)$item->productname;
73
			$title = (string)$item->productname;
79
			$pic = str_replace('http://', 'https://', (string)$item->imageurl);
74
			$pic = str_replace('http://', 'https://', (string)$item->imageurl);
80
			if (empty($pic)) {
75
			if (empty($pic)) {
81
			    continue;
76
			    continue;
82
			}
77
			}
Line 86... Line 81...
86
			}
81
			}
87
 
82
 
88
			switch ($merchantId) {
83
			switch ($merchantId) {
89
			    case 35126: // Sam Ash Music
84
			    case 35126: // Sam Ash Music
90
			        if ($item->category->primary == "Books/Dvds") {
85
			        if ($item->category->primary == "Books/Dvds") {
91
                        $type = 'NEW';
86
                        $type = 'New';
92
   	    			    $condition = "Brand New";
87
   	    			    $condition = "Brand New";
93
    	    			$category = "Book";
88
    	    			$category = "Book";
-
 
89
        			    $freeShippingCap = 0.00; // 9.99 on webpage
-
 
90
            			$handlingTime = 1;
-
 
91
            			$shippingCost = 0.00;
-
 
92
            			$shippingCurrency = 'USD';
94
    	    		} else {
93
    	    		} else {
95
    	    		    continue;
94
    	    		    continue 2; // next loop
96
    	    		}
95
    	    		}
97
			        break;
96
			        break;
98
 
97
 
99
			    case 13770: // Music Notes
98
			    case 13770: // Music Notes
100
                    $type = 'NEW';
99
                    $type = 'New';
101
   				    $condition = "Brand New";
100
   				    $condition = "Brand New";
102
    				$category = "Book";
101
    				$category = "Book";
-
 
102
       			    $freeShippingCap = 0.00;
-
 
103
           			$handlingTime = 1;
-
 
104
        			$shippingCost = 0.00;
-
 
105
        			$shippingCurrency = 'USD';
103
			        break;
106
			        break;
104
 
107
 
105
			    case 2653: // alibris (does not return any search results) bugbug
108
			    case 2653: // alibris (does not return any search results) bugbug
-
 
109
       			    $freeShippingCap = 39.00;
-
 
110
           			$handlingTime = 1;
-
 
111
        			$shippingCost = 3.99;
-
 
112
        			$shippingCurrency = 'USD';
106
			        break;
113
			        break;
107
 
114
 
108
   				default:
115
   				default:
109
                    $type = 'USED';
116
                    $type = 'Used';
110
   				    $condition = "Used";
117
   				    $condition = "Used";
111
    				$category = "CD";
118
    				$category = "CD";
-
 
119
       			    $freeShippingCap = 0.00;
-
 
120
        			$handlingTime = -1;
-
 
121
        			$shippingCost = 0.00;
-
 
122
        			$shippingCurrency = 'USD';
112
    				break;
123
    				break;
113
			}
124
			}
114
 
125
 
115
			$country = 'US';
126
			$country = 'US';
116
			$bestOffer = false;
127
			$bestOffer = false;
Line 134... Line 145...
134
			$location = 'US';
145
			$location = 'US';
135
			$zip = '';
146
			$zip = '';
136
			$feedbackScore = -1;
147
			$feedbackScore = -1;
137
			$feedbackPercent = -1;
148
			$feedbackPercent = -1;
138
			$sellerName = '';
149
			$sellerName = '';
139
			$handlingTime = -1;
-
 
140
			$shippingCost = 0.00;
-
 
141
			$shippingCurrency = 'USD';
-
 
142
 
150
 
143
// bugbug
151
// bugbug
144
//ls_cj_csv(array($merchantName,(string)$item->category->primary,(string)$item->productname,(string)$item->description->short,"'".$barcode,$barcodeType,minNotNull(array($item->price, (string)$item->saleprice)),(string)$item->linkurl));
152
//ls_cj_csv(array($merchantName,(string)$item->category->primary,(string)$item->productname,(string)$item->description->short,"'".$barcode,$barcodeType,minNotNull(array($item->price, (string)$item->saleprice)),(string)$item->linkurl));
145
 
153
 
146
            // this is last after all checks
154
            // this is last after all checks
Line 149... Line 157...
149
			    continue;
157
			    continue;
150
			}
158
			}
151
 
159
 
152
			$arr[] = array(
160
			$arr[] = array(
153
				"Merchant" => $merchantName,
161
				"Merchant" => $merchantName,
154
				"Type" => ($searchType == constant("NEW") ? 'New' : 'Used'),
162
				"Type" => "$type",
155
				"Title" => "$title",
163
				"Title" => "$title",
156
				"Barcode" => "$barcode",
164
				"Barcode" => "$barcode",
157
				"BarcodeType" => "$barcodeType",
165
				"BarcodeType" => "$barcodeType",
158
				"Image" => "$pic",
166
				"Image" => "$pic",
159
				"URL" => "$url",
167
				"URL" => "$url",
Line 171... Line 179...
171
				"FeedbackPercent" => "$feedbackPercent",
179
				"FeedbackPercent" => "$feedbackPercent",
172
				"SellerName" => "$sellerName",
180
				"SellerName" => "$sellerName",
173
				"HandlingTime" => "$handlingTime",
181
				"HandlingTime" => "$handlingTime",
174
				"ShippingCost" => "$shippingCost",
182
				"ShippingCost" => "$shippingCost",
175
				"ShippingCurrency" => "$shippingCurrency",
183
				"ShippingCurrency" => "$shippingCurrency",
-
 
184
				"FreeShippingCap" => "$freeShippingCap",
176
				"Show" => true
185
				"Show" => true
177
			);
186
			);
178
		}
187
		}
179
	}
188
	}
180
// If the response does not indicate 'Success,' log the error(s)
189
// If the response does not indicate 'Success,' log the error(s)