justlukeyou
-
Posts
957 -
Joined
-
Last visited
Posts posted by justlukeyou
-
-
I viewed the code and compared it against the demo and it appears to be the same. I have uploaded the images.
However when insert www.website.com/products/query.catslider.js into the address bar on my broweser is says that no file is found but it should be the same as a standard image file location.
** snipped - not relevant ~ .josh **
-
Hi,
I set the path first to my homepage directory / and then to my products directory /js/jquery.catslider.js and stil no impact.
-
come on man, use your brain. Most of the URLs in the script includes, css links and img src's are relative. You need to change them to point to your own hosted stuff. Did you upload the scripts and images and stuff to your own server?
I uploaded this script /modernizr.custom.63321.js and /query.catslider.js but they dont appear to have any impact.
-
Hi,
I removed the code for the ads but result has none of the functionality that the demo has.
-
As kicken said, as a guide, right-click and view the source on the demo page. You can see all of the html, css and javascript. You can see that they point to google's hosted jquery library. Then they put the slider code in a separate js file, which is a good practice. Then there's one line of javascript code after the 2 script includes, which is probably the trigger to load up and start running the slider. Just look at the source of the demo page.
Hi,
I copied the code from the source page but it brings with it an advert which obviously I dont want.
-
Hi,
I got the HTML and CSS working no problem. But I dont know how to get the Javascript working. I haven't used Javascipt before.
-
jQuery is a javascript library. You "install" it by adding a javascript script tag on your page(s). You can grab the latest version off jquery.com and host it yourself, or as an alternative, you can point to the one hosted by google, MaxCDN, etc..
What do you think is the best option?
There seems to be many different options to download.
-
-
Do you have jQuery installed on your machine?
No. Is this something I put on my server so anyone in the world can view the product display?
-
Hi,
I found this amazing product slider which was simple to set up. Until it came to the Javascript part "Let’s create a simple jQuery plugin"
How to Create a Simple Multi-Item Slider | Codrops
I have absolutely no idea what Im supposed to do with this part. I download the source files and uploaded the javascript files to my home folder but that no affect.
Can anyone advice what I should do with the javascript code to get that to work?
-
I just need to get this working. Im not a coder, I dont want to be coder and I dont want to pay someone $80 to redo code which I previously had working.
Can you advise what I need to do?
-
Yes my previous code appled the dbh to the query which inserts the datafeed into the table. How can instantiate it. Can I say that the contents from the query = the dbh ?
-
Hi,
Apologies I added another post. As I have had the code working before Im convinced its the dbh variable that is the problem. I have isolated the code and it is still that issue that causes it not to work. Is there away of declaring this against the query so I can run the cron job and then run the seperate code after the database is updated from the data feed?
$dbh->commit(); $dbh->query('UPDATE `furniture_groups` SET `room` = CASE
-
Hi,
I have to tried to isolate the code I am trying to add on it keeps coming back with the same problem.
It is now creating an error saying it is a non-object.
I need away of declaring this part:
$dbh->commit(); $dbh->query('UPDATE `furniture_groups` SET `room` = CASE
mysql_connect($host, $username, $password); mysql_select_db($database); $query = mysql_query("SELECT * FROM furniture_groups "); while($row = mysql_fetch_array($query)) { echo $row['long_name']; $dbh->commit(); $dbh->query('UPDATE `furniture_groups` SET `room` = CASE WHEN `long_name` LIKE \'%kitchen%\' THEN \'Kitchen\' WHEN `long_name` LIKE \'%coffee%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%living%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%sofa%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%otto%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%tv%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%cd%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%lounger%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%mirror%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%sideboard%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%lounge%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%nest of table%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%entertainment%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%bed%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%mattr%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%stool%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%wardrobe%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%chest%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%blanket box%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%headboard%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%futon%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%hall%\' THEN \'Hall\' WHEN `long_name` LIKE \'%bath%\' THEN \'Bathroom\' WHEN `long_name` LIKE \'%dressing%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%office%\' THEN \'Office\' WHEN `long_name` LIKE \'%bookcase%\' THEN \'Office\' WHEN `long_name` LIKE \'%filing%\' THEN \'Office\' WHEN `long_name` LIKE \'%computer desk%\' THEN \'Office\' WHEN `long_name` LIKE \'%extending%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%extendable%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%dining%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%wine rack%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%cushion%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%rug%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%vase%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%lamp%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%clock%\' THEN \'Home-Furnishings\' ELSE `room` END'); } ?>
-
How will I know the wrong thing is being inserted in the wrong way as I will just be echoing what is in my database regardless of whether I run a query in PHPMyAdmin or echo it to a page?
Im confused as to how a query run in MyAdmin is different to a query run on the page.
-
1. Are you sure that 'coffee table' is a part of the .xml file you're reading from?
2. Are you sure that all of the data in the INSERT that's working is being inserted correctly? In the right format, in the right columns?
3. Have you attempted to run your UPDATE query in phpMyAdmin? If not, do so.
Hi,
1 and 2 are fine. How do I do Number 3.
I am also trying run the code on its own by inserting everything into furniture groups and then running the update.
$dbh->query('UPDATE `furniture_groups` SET `room` = CASE WHEN `long_name` LIKE \'%kitchen%\' THEN \'Kitchen\' WHEN `long_name` LIKE \'%coffee%\' THEN \'Living-room\'
-
Hi,
Unfortunately it is not creating any error messages.
This is what I'm trying to aichieve. Lets say I have a spreadsheet and in column K I insert "coffee table". I have a piece of code which reads the insert, identifies the keyword "Coffee Table" and inserts "Living Room" into into column L. Because a coffee table is based in a living room. Altermatively if "mattress" is entered into column K, "bedroom" is entered into column L.
Its very frustrating as I have had this element of the working before.
Here is ALL the code I have:
{ $fp = $zip->getStream("datafeed_98057.xml"); //file inside archive if(!$fp) die("Error: can't get stream to zipped file"); $buf = ""; ob_start(); while (!feof($fp)) $buf .= fread($fp, 2048); $s = ob_get_contents(); ob_end_clean(); if(stripos($s, "CRC error") != FALSE) die('CRC32 mismatch'); fclose($fp); $zip->close(); $ax = strocc($buf, '<prod', '</prod>'); echo '<pre>'; for($i=0; $i<sizeof($ax); $i++) { $arr = $ax[$i]; echo strpp($arr, '<pId>', '</pId>') ."<br />"; $desc = ''; if(strpos($ax[$i], '<desc>')!==FALSE) { $desc = safe_string_escape(strpp($ax[$i], '<desc>', '</desc>')); } $discount = 0; if(floatval(strpp($arr, '<rrp>', '</rrp>'))!=0) $discount = 100 - (floatval(strpp($arr, '<buynow>', '</buynow>')) / floatval(strpp($arr, '<rrp>', '</rrp>')) * 100); mysql_query("insert into productdbase SET image_link = '" .safe_string_escape(strpp($arr, '<awImage>', '</awImage>')) ."', link = '" .safe_string_escape(strpp($arr, '<awTrack>', '</awTrack>')) ."', name = '" .safe_string_escape(strpp($arr, '<name>', '</name>')) ."', linkname = '" .str_replace("---", "-", str_replace(" ", "-", safe_string_escape(strpp($arr, '<name>', '</name>')))) ."', fulldescription = '$desc', price = '" .safe_string_escape(strpp($arr, '<rrp>', '</rrp>')) ."', discount = '$discount', merchant = '" .safe_string_escape(strpp($arr, 'name="', '"')) ."', promotional_text = '$desc', id = '" .strpp($arr, '<pId>', '</pId>') ."'"); mysql_query("insert into furniture_groups SET long_name = '" .safe_string_escape(strpp($arr, '<mCat>', '</mCat>')) ."', short_name = '" .safe_string_escape(strpp($arr, '<awCat>', '</awCat>')) ."', id = '" .strpp($arr, '<pId>', '</pId>') ."'"); //echo mysql_error(); } } else echo "zip not found"; unlink($file); function strocc($str, $pos1, $pos2) { $pos=0; $occ=array(); while(strpos($str, $pos1, $pos) && strpos($str, $pos2, strpos($str, $pos1, $pos))) { array_push($occ, strpp($str, $pos1, $pos2, $pos)); $pos = strpos($str, $pos2, strpos($str, $pos1, $pos)); } return ($occ); } function strpp($str, $pos1, $pos2, $startoffset=0) { return substr($str, (strpos($str, $pos1, $startoffset)+strlen($pos1)), strpos($str, $pos2, strpos($str, $pos1, $startoffset)+strlen($pos1))-(strpos($str, $pos1, $startoffset)+strlen($pos1))); } function mysqlinit($user, $pass, $db, $host='localhost') { $link = mysql_connect($host, $user, $pass); if (!$link) { echo('Cant connect to MySQL : ' .mysql_error()); return 0; } $db_selected = mysql_select_db($db, $link); if (!$db_selected) { echo('Cant use database ' .$db .': ' .mysql_error()); return 0; } return 1; } function safe_string_escape($str) { $len=strlen($str); $escapeCount=0; $targetString=''; for($offset=0;$offset<$len;$offset++) { switch($c=$str{$offset}) { case "'": if($escapeCount % 2 == 0) $targetString.="\\"; $escapeCount=0; $targetString.=$c; break; case '"': if($escapeCount % 2 == 0) $targetString.="\\"; $escapeCount=0; $targetString.=$c; break; case '\\': $escapeCount++; $targetString.=$c; break; default: $escapeCount=0; $targetString.=$c; } } return $targetString; } $dbh->query('UPDATE `furniture_groups` SET `room` = CASE WHEN `long_name` LIKE \'%kitchen%\' THEN \'Kitchen\' WHEN `long_name` LIKE \'%coffee%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%living%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%sofa%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%otto%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%tv%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%cd%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%lounger%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%mirror%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%sideboard%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%lounge%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%nest of table%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%entertainment%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%bed%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%mattr%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%stool%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%wardrobe%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%chest%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%blanket box%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%headboard%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%futon%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%hall%\' THEN \'Hall\' WHEN `long_name` LIKE \'%bath%\' THEN \'Bathroom\' WHEN `long_name` LIKE \'%dressing%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%office%\' THEN \'Office\' WHEN `long_name` LIKE \'%bookcase%\' THEN \'Office\' WHEN `long_name` LIKE \'%filing%\' THEN \'Office\' WHEN `long_name` LIKE \'%computer desk%\' THEN \'Office\' WHEN `long_name` LIKE \'%extending%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%extendable%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%dining%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%wine rack%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%cushion%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%rug%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%vase%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%lamp%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%clock%\' THEN \'Home-Furnishings\' ELSE `room` END'); ?>
-
Hi,
Does no one understand what I'm trying to do?
I think its pretty simple!
-
Hi,
I placed another advert at people are quoting me $80 but I paid $50 to have 98% of the code done. Im now trying to reuse code I had working before. This is ridiculous.
I tried changing it to the following but couldn't get that to work either. This sort of thing kills me:
$fp->query('UPDATE `furniture_groups` SET `room` = CASE WHEN `long_name` LIKE \'%kitchen%\' THEN \'Kitchen\' WHEN `long_name` LIKE \'%coffee%\' THEN \'Living-room\'
-
Hi,
Any suggestions please. As far I can see it is this part which I need to fix as the code up until works fine.
$dbh->query
I have tried using something like this but I am not using a string as a query. Can anyone suggest how I tie the code which inserts the which inserts the data into the table with the code which identifies the keyword and inserts a different keyword into $room.$mysql_query
-
Perhaps you should try checking your query's CASE syntax against the documentation
Thanks,
I didn't write the code and I dont understand the code enough. Is there in pirticular wrong with it?
I have had the code which inserts a key working before but I cant get it working again now.
-
Any suggestions please.
I cant really see how I can explain it. The concept seems quite simple. Im just looking to read the keyword from one column and insert a different keyword into a different column.
-
Hi,
If $long_name is "coffee table" the above code is supposed to insert "living room" into $room.
There are no error messages. I have had this working before but I have tried to streamline the rest of the cron job and now I cant get this to work.
This is ALL the code I currently have. 95% of it works. Just need to finish the final part off. Like I say I have had it working before, its incredibly frustrating that I cant get it to work now.
{ $fp = $zip->getStream("datafeed_98057.xml"); //file inside archive if(!$fp) die("Error: can't get stream to zipped file"); $buf = ""; ob_start(); while (!feof($fp)) $buf .= fread($fp, 2048); $s = ob_get_contents(); ob_end_clean(); if(stripos($s, "CRC error") != FALSE) die('CRC32 mismatch'); fclose($fp); $zip->close(); $ax = strocc($buf, '<prod', '</prod>'); echo '<pre>'; for($i=0; $i<sizeof($ax); $i++) { $arr = $ax[$i]; echo strpp($arr, '<pId>', '</pId>') ."<br />"; $desc = ''; if(strpos($ax[$i], '<desc>')!==FALSE) { $desc = safe_string_escape(strpp($ax[$i], '<desc>', '</desc>')); } $discount = 0; if(floatval(strpp($arr, '<rrp>', '</rrp>'))!=0) $discount = 100 - (floatval(strpp($arr, '<buynow>', '</buynow>')) / floatval(strpp($arr, '<rrp>', '</rrp>')) * 100); mysql_query("insert into productdbase SET image_link = '" .safe_string_escape(strpp($arr, '<awImage>', '</awImage>')) ."', link = '" .safe_string_escape(strpp($arr, '<awTrack>', '</awTrack>')) ."', name = '" .safe_string_escape(strpp($arr, '<name>', '</name>')) ."', linkname = '" .str_replace("---", "-", str_replace(" ", "-", safe_string_escape(strpp($arr, '<name>', '</name>')))) ."', fulldescription = '$desc', price = '" .safe_string_escape(strpp($arr, '<rrp>', '</rrp>')) ."', discount = '$discount', merchant = '" .safe_string_escape(strpp($arr, 'name="', '"')) ."', promotional_text = '$desc', id = '" .strpp($arr, '<pId>', '</pId>') ."'"); mysql_query("insert into furniture_groups SET long_name = '" .safe_string_escape(strpp($arr, '<mCat>', '</mCat>')) ."', short_name = '" .safe_string_escape(strpp($arr, '<awCat>', '</awCat>')) ."', id = '" .strpp($arr, '<pId>', '</pId>') ."'"); //echo mysql_error(); } } else echo "zip not found"; unlink($file); function strocc($str, $pos1, $pos2) { $pos=0; $occ=array(); while(strpos($str, $pos1, $pos) && strpos($str, $pos2, strpos($str, $pos1, $pos))) { array_push($occ, strpp($str, $pos1, $pos2, $pos)); $pos = strpos($str, $pos2, strpos($str, $pos1, $pos)); } return ($occ); } function strpp($str, $pos1, $pos2, $startoffset=0) { return substr($str, (strpos($str, $pos1, $startoffset)+strlen($pos1)), strpos($str, $pos2, strpos($str, $pos1, $startoffset)+strlen($pos1))-(strpos($str, $pos1, $startoffset)+strlen($pos1))); } function mysqlinit($user, $pass, $db, $host='localhost') { $link = mysql_connect($host, $user, $pass); if (!$link) { echo('Cant connect to MySQL : ' .mysql_error()); return 0; } $db_selected = mysql_select_db($db, $link); if (!$db_selected) { echo('Cant use database ' .$db .': ' .mysql_error()); return 0; } return 1; } function safe_string_escape($str) { $len=strlen($str); $escapeCount=0; $targetString=''; for($offset=0;$offset<$len;$offset++) { switch($c=$str{$offset}) { case "'": if($escapeCount % 2 == 0) $targetString.="\\"; $escapeCount=0; $targetString.=$c; break; case '"': if($escapeCount % 2 == 0) $targetString.="\\"; $escapeCount=0; $targetString.=$c; break; case '\\': $escapeCount++; $targetString.=$c; break; default: $escapeCount=0; $targetString.=$c; } } return $targetString; } $dbh->query('UPDATE `furniture_groups` SET `room` = CASE WHEN `long_name` LIKE \'%kitchen%\' THEN \'Kitchen\' WHEN `long_name` LIKE \'%coffee%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%living%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%sofa%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%otto%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%tv%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%cd%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%lounger%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%mirror%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%sideboard%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%lounge%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%nest of table%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%entertainment%\' THEN \'Living-room\' WHEN `long_name` LIKE \'%bed%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%mattr%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%stool%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%wardrobe%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%chest%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%blanket box%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%headboard%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%futon%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%hall%\' THEN \'Hall\' WHEN `long_name` LIKE \'%bath%\' THEN \'Bathroom\' WHEN `long_name` LIKE \'%dressing%\' THEN \'Bedroom\' WHEN `long_name` LIKE \'%office%\' THEN \'Office\' WHEN `long_name` LIKE \'%bookcase%\' THEN \'Office\' WHEN `long_name` LIKE \'%filing%\' THEN \'Office\' WHEN `long_name` LIKE \'%computer desk%\' THEN \'Office\' WHEN `long_name` LIKE \'%extending%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%extendable%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%dining%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%wine rack%\' THEN \'Dining-Room\' WHEN `long_name` LIKE \'%cushion%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%rug%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%vase%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%lamp%\' THEN \'Home-Furnishings\' WHEN `long_name` LIKE \'%clock%\' THEN \'Home-Furnishings\' ELSE `room` END'); ?>
-
Any suggestions please?
The problem I have is this part here:
$dbh->query
"Let’s create a simple jQuery plugin"
in Javascript Help
Posted
Hi,
I got the javascript file at the located now and removed the GA code - that was from the demo.
Still cant get it to work though. Very frustrating.