Website Build: Perfect-Shirts.co.uk

Website Build: Perfect-Shirts.co.uk

Last year I blogged about a logo concept for a website called Perfect-Shirts.co.uk. Well the concept has finally been made into a live website, perfect-shirts.co.uk

Special features of this particular build are that it is built on the excellent HTML5 framework Twitter Bootstrap, meaning I can get a full mobile experience from the site without having to code & update separate templates. The site uses an Affiliate Window feed. I did find it tricky using the feed as it wasn’t categorised correctly by the merchant. This meant I had to use some creative methods to categorise shirts myself.

In addition AW feeds tend to be quite large in terms of filesize and using PHP to extract the compressed feeds resulted in time-outs on lowly shared hosting. Thankfully linux command wget came to the rescue with a simple command to download and extract the feed in one simple cron job. Take a look at the site and tell me what you think in the comments section below

Oliver Partridge

Building websites since 2000, I have a wealth of experience in eMarketing, SEO, e-mail marketing and social media marketing. Google+ and Twitter

4 Comments

  1. aarch says:

    Hey Oliver,
    I saw your progress about parsing Affiliate Feeds. Now, I am trying some CMSs (Symphony, WordPress) like you did before. I am planning to run an affiliate shop. I am not sure which CMS to start with. Parsing differently formatted xml feeds is being really tricky. Every feed has a different structure, I really need flexible solution where I would be able to set replace functions etc. Do you have any suggestions?
    Best,

    • admin says:

      There was a script called affilistore or something like that (might be http://affilistore.sourceforge.net/), it took a feed and structured the data to some extent. You’ll need a CMS which allows you to plugin custom PHP/MySQL code of your own. I use CMS Made Simple, as it is easy to get going with without having to learn some framework. You could use WordPress as well, depends on your experience with it. Good Luck!

  2. aarch says:

    hey, thanks for the detailed answer. I will definitely check them now.

    • admin says:

      Below is the code I used for parsing Paid on Results XML feeds. I added some image manipulation routines at the end so the images fit into the themeforest theme I used for the site.

      < ?php if (!ini_get('max_execution_time')) { ini_set('max_execution_time', 2600); } function toAscii($str) { $clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $str); $clean = strtolower(trim($clean, '-')); $clean = preg_replace("/[\/_|+ -]+/", '-', $clean); return $clean; } $url = 'http://feeds.paidonresults.net/1.0template=XML&field_names=ProductID,ProductName,ProductPrice,SummaryDescription,ProductDescription,AffiliateURL,ImageURL120by120,ImageURL400by400,ProductAddedDate,Category,MerchantName'; $file = '/home/XXXXXXXX/paidonresults-feed.xml'; $current = file_get_contents($url); file_put_contents($file, $current); sleep(5); mysql_connect("localhost", "XXXXXXXX_cms", "XXXXXXXX") or die(mysql_error()); mysql_select_db("XXXXXXXX_cms") or die(mysql_error()); $sql = "TRUNCATE TABLE `XXXXXXXX`"; mysql_query($sql) or die(mysql_error()); $xml = simplexml_load_file("/home/XXXXXXXX/paidonresults-feed.xml"); foreach($xml->product as $product){

      $ProductID = $product->ProductID;
      $ProductName = trim($product->ProductName);
      $ProductName = addslashes($ProductName);
      $ProductPrice = $product->ProductPrice;
      $SummaryDescription = addslashes($product->SummaryDescription);
      $ProductDescription = addslashes($product->ProductDescription);
      $AffiliateURL = $product->AffiliateURL;
      $ImageURL120by120 = $product->ImageURL120by120;
      $ImageURL400by400 = $product->ImageURL400by400;
      $ProductAddedDate = $product->ProductAddedDate;
      $prettyURL = toAscii($ProductName);

      $Category = $product->Category;
      list($Category1, $Category2) = explode(">", $Category);

      $Category1 = trim(addslashes($Category1));
      $Category2 = addslashes(trim($Category2));

      $MerchantName = $product->MerchantName;

      /* Skip any png files */
      $mystring1 = 'png';
      $pos1 = stripos($ImageURL400by400, $mystring1);

      if ($pos1 === false) {
      // Original image
      $filename = $ImageURL400by400;
      $newfile = '/home/XXXXXXXX/public_html/uploads/images/product/thumbs/' . $ProductID . '.jpg';
      // Get dimensions of the original image
      list($current_width, $current_height) = getimagesize($filename);

      // The x and y coordinates on the original image where we
      // will begin cropping the image
      $left = 60;
      $top = 0;

      // This will be the final size of the image (e.g. how many pixels
      // left and down we will be going)
      $crop_width = 240;
      $crop_height = 400;

      // Resample the image
      $canvas = imagecreatetruecolor($crop_width, $crop_height);
      $current_image = imagecreatefromjpeg($filename);
      imagecopy($canvas, $current_image, 0, 0, $left, $top, $current_width, $current_height);
      imagejpeg($canvas, $newfile, 75);
      // Free up memory
      imagedestroy($canvas);

      $thumbfile = '/uploads/images/product/thumbs/' . $ProductID . '.jpg';

      $query = "INSERT INTO XXXXXXXX (ProductID, ProductName, ProductPrice, SummaryDescription, ProductDescription, AffiliateURL, ImageURL120by120, ImageURL400by400, ImageLarge, ProductAddedDate, Category1, Category2, MerchantName, prettyURL) VALUES ('$ProductID', '$ProductName', '$ProductPrice', '$SummaryDescription', '$ProductDescription', '$AffiliateURL', '$ImageURL120by120', '$thumbfile', '$ImageURL400by400', '$ProductAddedDate', '$Category1', '$Category2', '$MerchantName', '$prettyURL')";

      mysql_query($query) or die(mysql_error());
      }

      }

      ?>

Leave a Reply


  • Make CMSMS Cookie compliantMake CMSMS Cookie compliant

    Make CMSMS Cookie compliant

    Uncategorized

    This post will document the steps required to make CMS Made Simple compliant with the new EU Privacy Directive cookie laws. If you haven’t yet

  • Download Youtube under LinuxDownload Youtube under Linux

    Download Youtube under Linux

    Linux Media

    How-to download youtube videos to Linux (specifically Ubuntu, but should work for others) 1. Install required software sudo apt-get install youtube-dl 2. Run from the

  • Integrate Campaign Monitor API into CMS Made Simple

    Website Design & Development

    Situation To automate the newsletter sign-up process from your FormBuilder forms with Campaign Monitor Related posts: Campaign Monitor – Pay as you go bulk email