Home Drupal Drupal 7 Template Preprocess Functions and TPL Files – Advanced Ubercart Sites #6

Drupal 7 Template Preprocess Functions and TPL Files – Advanced Ubercart Sites #6

1 min read
13
0
42



You can now purchase the entire series on advanced e-commerce sites with Drupal 7 and Ubercart at http://torontowebsitedeveloper.com/creating-advanced-ubercart-sites-drupal-7

In this sixth drupal video tutorial of this ten part series, we continue with Drupal 7 theming and I show you how to use the template.php and node–product.tpl.php file to create a custom layout for our product pages. This allows us to pass single variables into our Ubercart product pages and render them in a specific order.

As a result, we end up with a 3 column layout of information. In the next video tutorial, I’ll show you how we can use LESS CSS to change the look and feel of our site.

Don’t wait for the release of the next tutorial, own the series today at http://torontowebsitedeveloper.com/creating-advanced-ubercart-sites-drupal-7

Load More Related Articles
Load More By admin
Load More In Drupal

13 Comments

  1. Michael Romagnoli

    October 15, 2020 at 2:33 am

    One item I don't see much information on is how to render or print out the attributes with their options for a product page. Could you provide any examples or information on that?

    Reply

  2. Stu Eee

    October 15, 2020 at 2:33 am

    SLOW DOWN! You talk so fast…… useless……

    Reply

  3. Adrià Calderer

    October 15, 2020 at 2:33 am

    Thank you! I've been struggling with preprocess functions for a while, and your video gave me a lot of light about it. 

    Reply

  4. staler verweij

    October 15, 2020 at 2:33 am

    is this also possible with 2 different themes on one site?
    get it working on one theme, but get a "Notice: Undefined variable" error message when i try to get it working with the other theme.
    all themes are made from scratch, there's no subtheme.
    Edit got it working now, problem was a typo in the template

    btw excellent tutorial, finaly i did get what i wanted 🙂

    Reply

  5. K greendius

    October 15, 2020 at 2:33 am

    Where can i get these code? Thanks for great tutorial!

    Reply

  6. Web Development Tutorials

    October 15, 2020 at 2:33 am

    it'll be very minor and definitely not noticeable…

    Reply

  7. NecroNetica

    October 15, 2020 at 2:33 am

    Thank you for the reply. That does make sense. Are there any practical performance issues with creating new variables, even when editing the information? Not sure how huge these variables get.

    Reply

  8. Web Development Tutorials

    October 15, 2020 at 2:33 am

    i'm guessing you are talking about the variables like uc_body, uc_image, etc? I created the variables in the preprocess function so that we had clean variables to use in the template file. You're right, we could have just used drupal_render to render all different content variables in the template file. However, by using the preprocess function, we create easy to use/read variables which makes the template file easier to maintain especially if someone could be taking over for you later on…

    Reply

  9. NecroNetica

    October 15, 2020 at 2:33 am

    I'm very new at drupal (some WordPress experience), but why did you create those variables in your preprocess function? To me, it looks like you could have just rendered those default key'ed variables in the node template file. What did that preprocess function do?

    Reply

  10. Web Development Tutorials

    October 15, 2020 at 2:33 am

    only thing i can tell you is there is something wrong on line 16 of your template.php file… something to do with your &. Did you forget a bracket or something? Depending on what text editor you are using, it may flag the error for you.

    Reply

  11. Christopher Ambrosini

    October 15, 2020 at 2:33 am

    Pete, thanks for all the great tutorials. They really have helped greatly.

    I have followed this tutorial through and ended up with the follow error.
    Parse error: syntax error, unexpected '&' in /home/content/06/10945706/html/drupal/sites/all/themes/uc_merchant/template.php on line 16

    Any thoughts?

    Reply

  12. Web Development Tutorials

    October 15, 2020 at 2:33 am

    My pleasure. With regards to your Q, to be honest, what is it you are looking to do? Display Suite (drupal DOT org / DS) might be the better option – allows you to manipulate the output of content types…

    Reply

  13. TelosMedia.Org

    October 15, 2020 at 2:33 am

    Hi Pete, Thanks again for the great tutorials.
    Do you know if one can use Drupal Panels Module to manipulate UC product page?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also

I Registered My Domain, Now What?

I Registered My Domain, Now What? Start here ➜ http://bit.ly/2W7mimhGoDaddy You racked you…