Everything posted by JoshD
-
Adding a search to a blog on a Magento site
Hi Guys, Rather than me trying to explain it all over again, here is a link to my stackoverflow ticket - http://stackoverflow.com/questions/16916360/adding-a-search-field-on-blog-in-magento I'm new to PHP and need to build a search feature on a Blog on a Magento site. I'm really just looking for some advice. Will I need to build the search functionality from scratch, or does Magento offer something out the box. I know the plugin doesn't come with a search feature built in. Any help would be much appreciated. Thanks, Josh
-
Adding a search to the blog on a Magento powered website
I'm looking to add a search field for a blog on one of our websites which is powered by Magento. We currently use a third party add-on - http://ecommerce.aheadworks.com/free-stuff/blog.html I've contacted aheadworks and the blog doesn't come with a search capability. However they said I could use something like http://ecommerce.aheadworks.com/magento-extensions/advanced-search.html but I’m not sure if this is there sales team trying to flog us another product. I'm new to PHP and even newer to Magento so really looking for some advice. Is it something I can build myself with relative ease? Or it something like the plugin they've recommend something I should be heading towards? I'd like the search results to output on a separate template, to one where the blog posts are listed. I've googled for a while now and all I can find if a product search. Just a little bit of info on how the blog currently works. There are two pages on the site where there different blog posts show, and depending on the category you select when adding a post. This will determine which page the post is then pulled through on. Any help would be much appreciated. Thanks!
-
Filtering by category with Django
Hi all, I'm hoping i'm able to explain this ok, but could really do with a hand. Python / Django is reasonably new to me and i've now started doing more pratical projects. I'm currently trying to add a category filter to my template. Currently on the template there news, views and a blog. In the right hand column there is a category filter. What i want to be able to do is when you click on one of the categories, it takes you to a seperate template displaying all the 'news, views and blog' posts within that category. I'm having a bit of difficulty working out what I need to do. This is code that currently displays the posts on the template: def news_views_home(request, blogType): categories = BlogCategory.objects.all() all_news = BlogPost.objects.filter(live=True, type='news').order_by("-override_date") all_blogs = BlogPost.objects.filter(live=True, type='blog').order_by("-override_date") all_articles = BlogPost.objects.filter(live=True, type='articles').order_by("-override_date") return render_to_response('news_views.html',{ 'all_news': all_news, 'all_blogs': all_blogs, 'all_articles': all_articles, 'categories': categories, }, context_instance=RequestContext(request)) {% for news in all_news|slice:"3" %} <div class="blogSingle"> <h4>{{news.title}}</h4> <span class="date">{{news.get_date|date:"d F Y"}}</span> <p>{{news.summary|safe}}</p> </div> {% endfor %} {% for article in all_articles %} <div class="articleSingle"> <h4>{{article.title}}</h4> <span class="date">{{article.get_date|date:"d F Y"}}</span> <p>{{article.summary|safe}}</p> </div> {% endfor %} <h2>By category</h2> <ul class="icon"> {% for category in categories %} <li><a href="news-views/c/{{category.slug}}">{{category.title}}</a></li> {% endfor %} </ul> So my logic was to create another view then on that view, then write some logic that detect the category you have selected. The reason i'm using another view is because I want to render a different template. So they are all in the same list, rather than bring split up like they are on the current view. Any help would be appreciated. If you need anymore info please, let me know. Thanks, Josh
- ;pound& in dropdown
-
;pound& in dropdown
Hey all, Having some issues. I have a dropdown box displaying mutiple prices. However in IE7 / 8 the dropdown box is not rendering thr ;pound& symbol and displaying the HTML code. I'm wondering whether this is common issue. I can't find anything online and not come across the problem before. The site is built in Django / Python. <select name='MaxPrice'> <option value='100000000'{% ifequal MaxPrice "100000000" %} selected='selected'{%endifequal%}>No Limit</option> <option value='800'{% ifequal MaxPrice "700" %} selected='selected'{%endifequal%}>£700pcm</option> <option value='800'{% ifequal MaxPrice "800" %} selected='selected'{%endifequal%}>£800pcm</option> <option value='900'{% ifequal MaxPrice "900" %} selected='selected'{%endifequal%}>£900pcm</option> <option value='1000'{% ifequal MaxPrice "1000" %} selected='selected'{%endifequal%}>£1000pcm</option> <option value='1100'{% ifequal MaxPrice "1100" %} selected='selected'{%endifequal%}>£1100pcm</option> <option value='5000000'{% ifequal MaxPrice "1200" %} selected='selected'{%endifequal%}>£1200pcm+</option> </select> Thanks, Josh
- Javascript Calender
-
Javascript Calender
Hey all, I have a Javascript calender and it's got a funny issue where it loads fine however the events that are being pulled only show when you click the next month link then when you go back to the previous month the events then show. I've had a good look through the JS and can't seem to see what's causing it i'm not a JS guru at all i'm fairly new to it. var dateFormat = function () { var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g, timezone = /\b(?:[PMCEA][sDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, timezoneClip = /[^-+\dA-Z]/g, pad = function (val, len) { val = String(val); len = len || 2; while (val.length < len) val = "0" + val; return val; }; // Regexes and supporting functions are cached through closure return function (date, mask, utc) { var dF = dateFormat; // You can't provide utc if you skip other args (use the "UTC:" mask prefix) if (arguments.length == 1 && Object.prototype.toString.call(date) == "[object String]" && !/\d/.test(date)) { mask = date; date = undefined; } // Passing date through Date applies Date.parse, if necessary date = date ? new Date(date) : new Date; if (isNaN(date)) throw SyntaxError("invalid date"); mask = String(dF.masks[mask] || mask || dF.masks["default"]); // Allow setting the utc argument via the mask if (mask.slice(0, 4) == "UTC:") { mask = mask.slice(4); utc = true; } var _ = utc ? "getUTC" : "get", d = date[_ + "Date"](), D = date[_ + "Day"](), m = date[_ + "Month"](), y = date[_ + "FullYear"](), H = date[_ + "Hours"](), M = date[_ + "Minutes"](), s = date[_ + "Seconds"](), L = date[_ + "Milliseconds"](), o = utc ? 0 : date.getTimezoneOffset(), flags = { d: d, dd: pad(d), ddd: dF.i18n.dayNames[D], dddd: dF.i18n.dayNames[D + 7], m: m + 1, mm: pad(m + 1), mmm: dF.i18n.monthNames[m], mmmm: dF.i18n.monthNames[m + 12], yy: String(y).slice(2), yyyy: y, h: H % 12 || 12, hh: pad(H % 12 || 12), H: H, HH: pad(H), M: M, MM: pad(M), s: s, ss: pad(s), l: pad(L, 3), L: pad(L > 99 ? Math.round(L / 10) : L), t: H < 12 ? "a" : "p", tt: H < 12 ? "am" : "pm", T: H < 12 ? "A" : "P", TT: H < 12 ? "AM" : "PM", Z: utc ? "UTC" : (String(date).match(timezone) || [""]).pop().replace(timezoneClip, ""), o: (o > 0 ? "-" : "+") + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4), S: ["th", "st", "nd", "rd"][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10] }; return mask.replace(token, function ($0) { return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1); }); }; }(); // Some common format strings dateFormat.masks = { "default": "ddd mmm dd yyyy HH:MM:ss", shortDate: "m/d/yy", mediumDate: "mmm d, yyyy", longDate: "mmmm d, yyyy", fullDate: "dddd, mmmm d, yyyy", shortTime: "h:MM TT", mediumTime: "h:MM:ss TT", longTime: "h:MM:ss TT Z", isoDate: "yyyy-mm-dd", isoTime: "HH:MM:ss", isoDateTime: "yyyy-mm-dd'T'HH:MM:ss", isoUtcDateTime: "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'" }; // Internationalization strings dateFormat.i18n = { dayNames: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], monthNames: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] }; // For convenience... Date.prototype.format = function (mask, utc) { return dateFormat(this, mask, utc); }; //<![CDATA[ function updateDatepicker(dates) { $('div.ajax-overlay').remove(); $('#calendar .ui-datepicker-calendar td a, #calendar .ui-datepicker-calendar td span').each(function(index, item){ if(dates[index] != '') $(item).addClass('event-day').attr("title",dates[index].join(' | ')); else $(item).removeAttr('href').parent().removeAttr('onclick'); }) } function getDates(newYear, newMonth) { $.getJSON('{% url events_calendar_dates 1111 22 %}'.replace('1111',newYear).replace('22',newMonth), {}, function(data) { if(data.error) { $('#calendar').remove(); } else if(data.days) { updateDatepicker(data.days);//data.days should be a list of string/false values corresponding to each day of the month and whether that day holds an event. for days that have events, strings should contain a html representation of the titles of that day's events } } ) } $(document).ready(function() { $('#calendar').datepicker({ dateFormat: 'yy-mm-dd', minDate: 0, firstDay: 1, onSelect: function(dateText, picker) { var dateVals = /\d{4}-\d{1,2}-\d{1,2}/.test(dateText) ? dateText.match(/\d{4}|\d{2}/g) : false; if(dateVals === false || !$('#calendar .ui-datepicker-calendar td a, #calendar .ui-datepicker-calendar td span').eq((dateVals[2] - 1)).hasClass('event-day')) { return false;//bad date format or not an event day } window.location = "{% url events_date "1111-22-33" %}" .replace('33', dateVals[2]) .replace('22', dateVals[1]) .replace('1111', dateVals[0]); }, onChangeMonthYear: function(newYear, newMonth, inst) { $('#calendar').append('<div class="ajax-overlay"><div class="ajax-loading">Loading Calendar</div></div>'); $('#calendar .ajax-overlay, #calendar .ajax-loading').css({ width: function(){return $('#calendar').width();}, height: '5000px' }); $('#calendar .ajax-loading').css({paddingTop: "120px"}); getDates(newYear, newMonth); } }); setTimeout("setDateFormat()", 500); }); function setDateFormat() { // Convert date formats $(".hasDatepicker").each(function() { currentdate = new Date($(this).val()); newdate = dateFormat(currentdate, "dd/mm/yyyy"); $(this).val(newdate); }); } If you need anymore information let me know, but I should it's something to do with the way you click next and that's triggering the JS to load which shows the events. Idealy this needs to be done on page load. Thanks in advance. Josh
- Fonts
- Fonts
-
Fonts
Hey all... Looking at using a custom font that a designer has given me for the website I am building. The font is 'American Typewriter'. I want to be able to use this font and for everyone to able to see it on there PC's without installing it. Do i just host it on the web server for this to happen? Thanks in advance, Josh
- Members Twitter
-
Cant get wrapper to move down
#wrapper { margin: 0 auto; width:900px; padding-top:20px; Give that a try. All you need to do is add margin or some padding from the top of the div. Hope that helps
-
What Does Your Desktop Look Like
Tom, please change your resolution xD
-
My Portfolio
The text also needs to be text and not an image. Looks far to pixelated! Make everything a tad smaller it will look 10x better... Do something about your pic, even if it another 'sketch' version does not look right. I would have a look at some other portfolios online and get some tips.
-
My Portfolio
Looks like a bebo profile. Change your pic. Like the menu at the top though!
-
Javascript / InDesign
Hey guys, I have had someone ask me to look at a JS script which is running with in InDesign. Basically what they want to happen is when they click Run script they want it to click the ok buttons on the next 2 pop ups automatically without moving the mouse. I roughly understand the code but don't know what to add in the code for this to happen. Any help would be really appreciated. Thanks, Josh (I have uncluded the script) //LabelGraphics.jsx (Modified) //An InDesign CS3 JavaScript /* @@@BUILDINFO@@@ "LabelGraphics.jsx" 1.1.0 6-June-2008 */ //Adds labels to the graphics in the active document. /* This sample script has been modified. The modications are listed here: option added to create a label from clipboard data, dropdown menu added to apply a swatch to the caption frame. This script can now apply lables to just the selected graphics if you have one or more images selected. Otherwise it will apply the lables to all graphics in the document. The hieght of the caption frame is determined by the amount of text, and paragraph style applied. the width of the caption frame is determined by the width of the graphic it is under. Setting the caption height in the dialog box has been removed, as it is no longer needed. */ main(); //=============================================================\\ function main(){ if(app.documents.length != 0){ if(app.documents.item(0).allGraphics.length != 0){ myDisplayDialog(); } else{ alert("Document contains no graphics."); } } else{ alert("Please open a document and try again."); } } //=============================================================\\ function myDisplayDialog(){ var myLabelWidth = 100; var myStyleNames = myGetParagraphStyleNames(); var mySwatchNames = myGetSwatchNames(); var myDialog = app.dialogs.add({name:"LabelGraphics"}); with(myDialog.dialogColumns.add()){ //Label type with(dialogRows.add()){ with(dialogColumns.add()){ staticTexts.add({staticLabel:"Label Type", minWidth:myLabelWidth}); } with(dialogColumns.add()){ var myLabelTypeDropdown = dropdowns.add({stringList:["File name"], selectedIndex:4}); } } with(dialogRows.add()){ with(dialogColumns.add()){ staticTexts.add({staticLabel:"Label Offset", minWidth:myLabelWidth}); } with(dialogColumns.add()){ var myLabelOffsetField = measurementEditboxes.add({editValue:0}); } } //Style to apply with(dialogRows.add()){ with(dialogColumns.add()){ staticTexts.add({staticLabel:"Label Style", minWidth:myLabelWidth}); } with(dialogColumns.add()){ var myLabelStyleDropdown = dropdowns.add({stringList:myStyleNames, selectedIndex:0}); } } //Swatch to apply with(dialogRows.add()){ with(dialogColumns.add()){ staticTexts.add({staticLabel:"Apply swatch", minWidth:myLabelWidth}); } with(dialogColumns.add()){ var mySwatchDropdown = dropdowns.add({stringList:mySwatchNames, selectedIndex:0}); } } } //=============================================================\\ var myResult = myDialog.show(); if(myResult == true){ var myLabelType = myLabelTypeDropdown.selectedIndex; var myLabelHeight = 24; // A generic label height that will be adjusted later myPasteFailure = false; var myLabelOffset = myLabelOffsetField.editValue; var myLabelStyle = myStyleNames[myLabelStyleDropdown.selectedIndex]; var mySwatch = mySwatchNames[mySwatchDropdown.selectedIndex]; myDialog.destroy(); var myOldXUnits = app.documents.item(0).viewPreferences.horizontalMeasurementUnits; var myOldYUnits = app.documents.item(0).viewPreferences.verticalMeasurementUnits; app.documents.item(0).viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points; app.documents.item(0).viewPreferences.verticalMeasurementUnits = MeasurementUnits.points; try{ myAddLabels(myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, mySwatch); } catch(e){ alert("Unable to add lables. " + e); } try{ resizeOverset() ; } catch(e){ alert("Unable to correct overset text. " + e); } if (myPasteFailure == true){ alert("Unable to paste from clipboard."); } app.documents.item(0).viewPreferences.horizontalMeasurementUnits = myOldXUnits; app.documents.item(0).viewPreferences.verticalMeasurementUnits = myOldYUnits; } else{ myDialog.destroy(); } } //=============================================================\\ function myAddLabels(myLabelType, myLabelHeight, myLabelOffset, myLabelStyleName, mySwatchName){ var myDocument = app.documents.item(0); myStoriesArray = new Array(); if (app.selection.length == 0) // If nothing is selected apply caption to all graphics in the document { var myConfirmation = confirm("Add captions to all images in the document?", false, "LabelGraphics.jsx" ); if (myConfirmation == true) { var myGraphics = myDocument.allGraphics; } } else { // If graphics are selected, just add captions to the selected items, as long as they are rectangles(image frames) var myConfirmation = true; var mySelections = app.selection; myGraphics = new Array(); for(i = 0; i < mySelections.length; i++){ if(mySelections[i] == "[object Rectangle]"){ //Check to make sure selection only includes rectangles myGraphics.push(mySelections[i].allGraphics[0]); } else{ //alert("Objects other than graphics were selected!"); //Nothing happens if you don't select at least one graphic } } } myLabelStyle = myDocument.paragraphStyles.item(myLabelStyleName); mySwatch = myDocument.swatches.item(mySwatchName); if (myConfirmation == true){ for(var myCounter = 0; myCounter < myGraphics.length; myCounter++){ try{ myAddLabel(myDocument, myGraphics[myCounter], myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, mySwatch, myStoriesArray); } catch(e){}; } } } //=============================================================\\ function myAddLabel(myDocument, myGraphic, myLabelType, myLabelHeight, myLabelOffset, myLabelStyle, mySwatch, myStoriesArray){ var myLabel; var myLink = myGraphic.itemLink; var myPasteFromClipboard = false; //Create the label layer if it does not already exist. var myLabelLayer = myDocument.layers.item("labels"); try{ myLabelLayer.name; } catch (myError){ myLabelLayer = myDocument.layers.add({name:"labels"}); } //Label type defines the text that goes in the label. switch(myLabelType){ //File name case 0: myLabel = myLink.name; break; //File path case 1: myLabel = myLink.filePath; break; //XMP description case 2: try{ myLabel = myLink.linkXmp.description; } catch(myError){ myLabel = "No description available."; } break; //XMP author case 3: try{ myLabel = myLink.linkXmp.author } catch(myError){ myLabel = "No author available."; } break; //Paste from the clipboard case 4: try{ myPasteFromClipboard = true; } catch(myError){ myLabel = "No clipboard data available."; } break; } var myFrame = myGraphic.parent; myX1 = myFrame.geometricBounds[1]; myY1 = myFrame.geometricBounds[2] + myLabelOffset; myX2 = myFrame.geometricBounds[3]; myY2 = myY1 + myLabelHeight; if (myPasteFromClipboard ==true) { try{ var myTextFrame = myFrame.parent.textFrames.add(myLabelLayer, undefined, undefined,{geometricBounds:[myY1, myX1, myY2, myX2]}); myTextFrame.insertionPoints.item(0).select(); app.paste(); } catch(e){ myTextFrame.remove(); myPasteFailure = true; } } else{ var myTextFrame = myFrame.parent.textFrames.add(myLabelLayer, undefined, undefined,{geometricBounds:[myY1, myX1, myY2, myX2], contents:myLabel}); } myTextFrame.textFramePreferences.firstBaselineOffset = FirstBaseline.leadingOffset; myTextFrame.paragraphs.item(0).appliedParagraphStyle = myLabelStyle; myTextFrame.fillColor = mySwatch; myFrameParentStory = myTextFrame.parentStory; myStoriesArray.push(myFrameParentStory); } //=============================================================\\ function myGetParagraphStyleNames(){ var myStyleNames = app.documents.item(0).paragraphStyles.everyItem().name; return myStyleNames; } function myGetSwatchNames(){ var mySwatchNames = app.documents.item(0).swatches.everyItem().name; return mySwatchNames; } function resizeOverset() { for (var j = myStoriesArray.length - 1; j >= 0; j--) { myLastFrame = myStoriesArray[j].texts[0].parentTextFrames[myStoriesArray[j].texts[0].parentTextFrames.length - 1]; myNewY2 = myLastFrame.geometricBounds[3]; //get the width of the text frame before doing fit() myLastFrame.fit(FitOptions.FRAME_TO_CONTENT); myNewY1 = myLastFrame.geometricBounds[1]; myNewX1 = myLastFrame.geometricBounds[2]; myNewX2 = myLastFrame.geometricBounds[0]; myLastFrame.geometricBounds = [myNewX1, myNewY1, myNewX2, myNewY2]; // reset the width to before fit() was ran } }
-
Jquery image zoom issue
The image has a border of 4px you need to remove that.
-
New site
Hey all, Just put together a little site for the company I work for. The idea of it is to advertise the product with a clean approach. I have tried something a little different so just want to get some feedback on what you think. If anyone has any cross browser / platform problems please let me know. http://www.efar.co.uk/dev/wmesh/ Thanks, Josh
-
Car :(
Oh dear..well the thing is i start my new development job next week and it's about a 40 minute drive away from myself. So as long as i have something to get to work i don't mind
-
Christmas!
So i was thinking of what to get for Christmas? I was thinking possibly a Graphics tablet to give it a try but not sure whether it would be worth it? Does anyone know of any gizmo's or gadgets that may be useful the web design / development world?
-
Car :(
Nice one guys, thanks for the feedback. Going to contact my insurance company and see what they say! BMW said they can pick up my car and lend me a vehicle while the work is being done! Just hope my insurance company / there insurance company get funny about it.
-
Car :(
Yeahhhh maann!!! That will be nice! I might accidentally not give it back then xD
-
Car :(
Well luckily she has admitted to it so her insurance company will be paying for it! BMW are offering a 3 year guarantee and they will lend me a car while the work is being done! Before i do get them to do it though I will make sure I have something to fall back on if the work is not adequate.
-
Car :(
Hey all, So last night I was round my GF's house and we had a knock at the door. It was her next door neighbour saying that she had just reversed her car into mine. I have a BMW 316 which i picked up 3 months ago and I love it. It's my first real car and it's my pride and joy. Luckily the damage is not too bad and she has owned up it etc so it could be a lot worse. The damage is a big dent to the passenger door (not a deep one) a chunk has also been taken out of the trim along the bottom And a small dent by the door handle. My insurance company have given me a list of a few garages where I can get it repaired to. The only one i recognise is the Vauxhall garage, being a car dealer I am thinking they may be the best people to do the work. However I said to the lady on the phone I would rather get it done via BMW and she said that is fine but I won't get the 5 years warranty they offer. (Because these garages are the insurance companies approved garages aka partners) So i was wondering what you all think I should do? At the end of the day I don't want to get the work done and the paint to be a different colour when you look at it from different angles as I have seen this many times in the past. Thanks, Josh
-
Javascript / Jquery
Good afternoon all! Just wanted to ask a little question about JS / Jquery. I am currently learning a little PHP, JS and Jquery. However, In some of my freelance work I am required to do a lot of drop down menus and scrolling image galleries. So I was wondering someone would mind explaining some of the main differences between JS & Jquery. I know what Jquery is but i am just thinking to myself it might make more sense to concentrate learning Jquery rather than JS? If you could give me maybe a breakdown of the two and some examples of what they are used for that would be fantastic! Thanks, Josh