diff --git a/application/controllers/ItemController.php b/application/controllers/ItemController.php index 495ea54..56e1efc 100755 --- a/application/controllers/ItemController.php +++ b/application/controllers/ItemController.php @@ -9,6 +9,11 @@ class ItemController extends Zend_Controller_Action { + public function init() + { + $this->view->site = $this->getRequest()->getParam('site'); + } + public function indexAction() { $this->_forward('view'); diff --git a/application/layouts/scripts/layout.phtml b/application/layouts/scripts/layout.phtml index ba84214..85c404c 100755 --- a/application/layouts/scripts/layout.phtml +++ b/application/layouts/scripts/layout.phtml @@ -3,11 +3,18 @@ Darkstar's Woot-off Checker v3 - headLink()->appendStylesheet('/css/style.css') ?> + headLink()->appendStylesheet('/css/common.css') ?> + headLink()->appendStylesheet('/css/'.$this->site.'.css') ?> + headLink(); ?> - - layout()->content; ?> - +
+ + layout()->content; ?> +
+
+
+ placeholder('secondary'); ?> +
\ No newline at end of file diff --git a/application/views/scripts/item/view.phtml b/application/views/scripts/item/view.phtml index ddc206c..98ae4e1 100755 --- a/application/views/scripts/item/view.phtml +++ b/application/views/scripts/item/view.phtml @@ -1,45 +1,60 @@ -productData); ?> -
+productData); ?> +
- <?php echo str_replace('productData['title']); ?>" src="/images/products/productData['id'] ?>productData['file_extension']; ?>" /> -
-
- productData['title']; ?> -
-
- $productData['price']; ?> -
-
- + $productData['shipping']; ?> shipping -
-
- Condition: productData['condition']; ?> -
-
- Product: -
    - productData['products'] as $product): ?> -
  • - -
-
- -
- comment(s) -
-
- productData['subtitle']; ?> -
-
- productData['teaser']; ?> -
-
\ No newline at end of file + <?php echo str_replace('productData['title']); ?>" src="/images/products/productData['id'] ?>productData['file_extension']; ?>" /> +
+
+
+ productData['title']; ?> +
+
+ $productData['price']; ?> +
+
+ + $productData['shipping']; ?> shipping +
+
+
+
Condition:
+
+ productData['condition']; ?> +
+
+
+
+
+
Product:
+ productData['products'] as $product): ?> +
+ +
+ +
+
+
+ +
+ comment(s) +
+
+
+
+
+ +placeholder('secondary')->set( + '
'. + str_replace("'",''',$this->productData["subtitle"]) . + '
+
' . + str_replace("'", ''', $this->productData["teaser"]) . + '
' + ); \ No newline at end of file diff --git a/library/Ds/Service/WootFeed.php b/library/Ds/Service/WootFeed.php index e556264..d91161a 100755 --- a/library/Ds/Service/WootFeed.php +++ b/library/Ds/Service/WootFeed.php @@ -88,6 +88,7 @@ public function getCurrentProduct($site) //Unable to fetch data from woot or insert data. $this->_db->rollBack(); $this->_dao->unlockApplicationUpdates(); + throw new Exception($e->getMessage(), 500, $e); } } return $data; @@ -122,9 +123,9 @@ protected function _fetchWootRss($site) curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $xml = curl_exec($ch); + if (curl_errno($ch)) { $error = curl_error($ch); - curl_close($ch); throw new Exception($error); } curl_close($ch); @@ -156,7 +157,6 @@ protected function _fetchProductImages($itemId, array &$data) curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $standard = curl_exec($ch); if (curl_errno($ch)) { - curl_close($ch); throw new Exception(curl_error($ch)); } curl_close($ch); @@ -167,7 +167,6 @@ protected function _fetchProductImages($itemId, array &$data) curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $detail = curl_exec($ch); if (curl_errno($ch)) { - curl_close($ch); throw new Exception(curl_error($ch)); } curl_close($ch); @@ -189,7 +188,7 @@ protected function _parseWootRss($xml) $item['condition'] = (string)$wootNamespace->condition; $item['thread'] = (string)$wootNamespace->discussionurl; $item['purchase_url'] = (string)$wootNamespace->purchaseurl; - $item['price'] = (float)str_replace('$','',$wootNamespace->price); + $item['price'] = number_format((float)str_replace('$','',$wootNamespace->price),2); preg_match('/\$([\d\.]*)/',$wootNamespace->shipping, $matches); @@ -204,6 +203,15 @@ protected function _parseWootRss($xml) $images['standard'] = (string)$wootNamespace->standardimage; $images['detail'] = (string)$wootNamespace->detailimage; + //Woot tends to use UTF-8 characters in their filenames. cURL doesn't like this. + $standardUrl = parse_url($images['standard']); + $standardUrl['path'] = substr($standardUrl['path'], 1); + $images['standard'] = str_replace($standardUrl['path'], urlencode($standardUrl['path']), $images['standard']); + + $detailUrl = parse_url($images['detail']); + $detailUrl['path'] = substr($detailUrl['path'], 1); + $images['detail'] = str_replace($detailUrl['path'], urlencode($detailUrl['path']), $images['detail']); + $products = array(); foreach($wootNamespace->products->product as $product) { diff --git a/library/Ds/Service/WootFeed/DbDao.php b/library/Ds/Service/WootFeed/DbDao.php index fb0eb31..2ee5b9a 100755 --- a/library/Ds/Service/WootFeed/DbDao.php +++ b/library/Ds/Service/WootFeed/DbDao.php @@ -140,7 +140,7 @@ public function fetchItemListBySite($site, $page=1, $limit=10) INNER JOIN history h ON h.item_id = i.id WHERE i.site = ? - ORDER BY h.updated ASC + ORDER BY h.updated DESC LIMIT ?,?'; $dtos = null; @@ -172,7 +172,7 @@ protected function _recordReduce($records) 'condition' => $record['condition'], 'thread' => $record['thread'], 'purchase_url' => $record['purchase_url'], - 'price' => round($record['price'],2), + 'price' => number_format($record['price'],2), 'shipping' => round($record['shipping'],2), 'wootoff' => (bool)$record['wootoff'], 'title' => $record['title'], diff --git a/public/css/common.css b/public/css/common.css new file mode 100755 index 0000000..44fce7f --- /dev/null +++ b/public/css/common.css @@ -0,0 +1,122 @@ +.triangle { + height: 0; + width: 0; + border-width: 25px 37px; + border-color: #FFF transparent transparent transparent; + border-style: solid; + position: absolute; + left: 115px; +} + +#logo { + width: 811px; + margin: 0 auto; + border-width: 0 0 5px 0; + border-color: #E2E2E2; + border-style: solid; + font-size: 30px; + font-weight: bold; +} + +#main-wrapper { + background-color: #FFF; +} + +#product-container { + margin: 0 auto; + width: 811px; +} + +#secondary-wrapper { + background-color: rgba(255,255,255,.4); + border-radius: 5px; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + /* For IE 7*/ + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#66FFFFFF, endColorstr=#66FFFFFF); + /* For IE 8*/ + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#66FFFFFF, endColorstr=#66FFFFFF)"; + padding: 15px 15px 15px 15px; + margin: 17px auto; + width: 781px; +} + +body { + font-family: "Trebuchet MS",Trebuchet,Calibri,Tahoma,Arial,sans-serif; + margin: 0; + padding: 0; +} + +#image, #product-info { + float: left; +} + +#image { + width: 456px; +} + +#product-info { + width: 355px; +} + +.clearfix { + clear: both; + width: 100%; + position: relative; +} + +#subtitle { + font-size: 16px; + font-weight: bold; + text-transform: uppercase; + margin: 5px 0; +} + +#teaser { + color: #FFF; + font-size: 22px; + margin-top: 10px; +} + +#title { + font-size: 20px; + padding: 6px 5px 5px 0px; +} + +#price { + font-weight: bold; + font-size: 22px; + float: left; + margin-bottom: 4px; +} + +#shipping { + font-size: 11px; + margin: 8px 0 0 30px; + float: left; +} + +#condition, #product { + clear: both; + font-size: 11px; +} + +#condition dd, #product dd { + margin-left: 90px; + margin-bottom: 5px; + float: left; + width: 250px; +} + +#condition dt, #product dt { + width: 80px; + float: left; + padding: 0 0 5px 0; + position: absolute; +} + +#condition dt, #product dt { + color: #999; + text-transform: uppercase; + font-size: 12px; +} \ No newline at end of file diff --git a/public/css/home.css b/public/css/home.css new file mode 100755 index 0000000..6f09cd1 --- /dev/null +++ b/public/css/home.css @@ -0,0 +1,15 @@ +body { + background-color: #EFEAE6; +} + +#secondary-wrapper { + background-color: #EFEAE6; + /* For IE 7*/ + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFEFEAE6, endColorstr=#FFEFEAE6); + /* For IE 8*/ + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFEFEAE6, endColorstr=#FFEFEAE6)"; +} + +#logo, #teaser { + color: #D35500; +} \ No newline at end of file diff --git a/public/css/kids.css b/public/css/kids.css new file mode 100755 index 0000000..6c192de --- /dev/null +++ b/public/css/kids.css @@ -0,0 +1,15 @@ +body { + background-color: #FFE086; +} + +#secondary-wrapper { + background-color: #E19433; + /* For IE 7*/ + filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFE19433, endColorstr=#FFE19433); + /* For IE 8*/ + -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFE19433F, endColorstr=#FFE19433)"; +} + +#logo { + color: #E19433; +} \ No newline at end of file diff --git a/public/css/moofi.css b/public/css/moofi.css new file mode 100755 index 0000000..df50724 --- /dev/null +++ b/public/css/moofi.css @@ -0,0 +1,7 @@ +body { + background-color: #61861E; +} + +#logo { + color: #61861E; +} \ No newline at end of file diff --git a/public/css/sellout.css b/public/css/sellout.css new file mode 100755 index 0000000..216802a --- /dev/null +++ b/public/css/sellout.css @@ -0,0 +1,7 @@ +body { + background-color: #4B437D; +} + +#logo { + color: #4B437D; +} \ No newline at end of file diff --git a/public/css/shirt.css b/public/css/shirt.css new file mode 100755 index 0000000..66da342 --- /dev/null +++ b/public/css/shirt.css @@ -0,0 +1,7 @@ +body { + background-color: #216294; +} + +#logo { + color: #216294; +} \ No newline at end of file diff --git a/public/css/wine.css b/public/css/wine.css new file mode 100755 index 0000000..9f79cd9 --- /dev/null +++ b/public/css/wine.css @@ -0,0 +1,11 @@ +body { + background-color: #8A1B26; +} + +#title, #subtitle, #teaser { + font-family: Georgia,"Times New Roman",Times,serif; +} + +#logo { + color: #8A1B26; +} \ No newline at end of file diff --git a/public/css/woot.css b/public/css/woot.css new file mode 100755 index 0000000..df50724 --- /dev/null +++ b/public/css/woot.css @@ -0,0 +1,7 @@ +body { + background-color: #61861E; +} + +#logo { + color: #61861E; +} \ No newline at end of file