Categories
Development

PayPal Buy Now add quantity with HTML

I was working on a project where PayPal Buy Now buttons were being generated by a widget and not allowing the quantity option to be used when a user was making a purchase. PayPal’s button generator does easily allow for quantities to be enabled with simple click, but this wasn’t an option for me in this case.

It was fairly difficult finding the tag to add to enable quantity on checkout, so I figured I’d share in case someone else ran into the same issue. Official documentation was eventually found.

It’s a very basic input that must be included with the form:

<input type="hidden" name="undefined_quantity" value="1">

<input type=”hidden” name=”undefined_quantity” value=”1″>

That’s all, just include that with the form and you’re all set.

Categories
Development

Display WordPress Child Pages as a List of Links

After figuring this one out, it’s really easy to do but I did have a hard time since I didn’t bother to check and see if a specific function already existed to do this behavior.

I wanted to display all the child pages of a Page as an unordered list. I initially tried using the WP_Query function to make this work. I tried creating a loop and feeding it some parameters, but kept getting no results.

Upon some further searching I did come across the wp_list_pages() function. I’m not sure why I didn’t begin with this, but for some reason I was set on using WP_Query.

There’s a ton of parameters and some great examples found on the wp_list_pages() page.

Here’s the little bit of code I added to a template to output the child pages as a list. Notice that the parent page’s id is the 32 that you will see as a parameter below. Enter whatever your parent page’s id is in it’s place.

wp_list_pages('sort_column=menu_order&amp;title_li=&amp;child_of=32');

Doesn’t really get much easier that that.

Categories
Development

Trashing a Draft on the Server with Adobe Contribute

I was dealing with a very bizarre draft issue with Adobe Contribute CS5, that we finally solved after much head scratching.

A Draft was showing up for only 1 user that a Draft that she had sent to me to publish was still being reviewed by me. This wasn’t the case, however no matter how many times we tried to remove the .LCK file or edit the page again etc. it was still telling her that I was still reviewing it. So she could no longer edit that page, yet any other user could.

We deleted traces of the draft on the server then her local machine. However, her Contribute would recreate the draft status. So after much work, we finally went to her Draft Console and right mouse clicked on the Draft and viewed properties.

Up opened a wonderful little video stating the drafts filename (it’s a pretty crazy random string) as well as the URL path to where this phantom Draft existed on the server.

Once we had this path, we were able to delete the remnants of this Draft from the server and all is well again. Damn you Contribute, damn you to hell.

Categories
Development

Theme Fields in Drupal 7

This is so easy now that I know how to do it, but I didn’t realize that fields could be themed similar to nodes.

Just create a template file titled:

field–[field_name].tpl.php

Drupal 7 Content types

and save it in your theme’s directory:

/sites/all/themes/[your_theme]/

You can get the field name on the Content Type screen, Structure > Content types > [your_content_type]

Then you just enter your markup in the field–[field_name].tpl.php file that you’ve created.

You can use the field.tpl.php file located in /modules/field/theme/field.tpl.php as a starting point.

 

Categories
Development

Drupaldelphia 2011

DrupaldelphiaAttended Drupaldelphia at Alter Hall at Temple University today. I took the journey to Philly with Mark, he drove since he knows Philadelphia much better than I. He actually knew many facts about various buildings and areas.

The facilities at Temple were very impressive. Great sized lecture rooms, with 2 large screens and electrical outlets everywhere for everyone’s laptops. The wifi was also great too, didn’t have a single issue once I logged in.

All the sessions I attended were pretty solid too.

  • Open Academy: A higher education Drupal product for departmental websites
  • Keynote
  • Building a backend content administrators will love
  • Making Site Mobile Friendly
  • Ten Steps to Becoming a Panels Pro

Some very good and insightful stuff. Picked up some new tricks and gained confidence in some cases, knowing that what I had been doing in some cases is what was suggested as best practice too.

The mobile and content administration stuff were very relevant to some current projects I’m working on. So the timing couldn’t of been better.

Lunch was pretty amazing too. I wasn’t expecting much of anything, but it was really good. Just the right amount of food too. They also gave out free t-shirts too. So now I have another Drupal shirt.

All in all an extemely very well done event. Drupal continues to be an amazing platform. I’m so glad that I attended and definitely am looking forward to another one next year.

Categories
Development

Output WordPress Gallery In Sidebar

A client really wanted to make use of the built in WordPress gallery shortcode. It’s a really cool built in feature to WordPress that easily allows them to manage basic photo galleries. But we wanted the gallery thumbnails to be generated in a sidebar, not the actual Page or Post.

This took a bit of time to figure out how to do, but luckily it was right in front of me in the WordPress documentation.  I just entered the following in the sidebar.php file (just gallery in the brackets):

echo do_shortcode('[the-word-gallery-goes-here]'); 

You can add that standard gallery shortcode options to that as well. So simple, I can’t believe it took me as long as it did to figure this one out.