Ubercart deployment strategy for site redesign

Posts: 41
Joined: 09/07/2007

Introduction
At the beginning of this year I took over administration of my company's website, www.xikar.com, from an out of house designer who had been running it for years. Needless to say, it was time for a redesign of the site. It is an .asp based site with an Access database for the back end. There is no CMS setup so adding new products is pain. After doing tons of research, I decided to use Drupal and Ubercart. I am really impressed with the dedication I see in the Ubercart community, the many features, user interface, and the speed of development when compared to the e-Commerce module. My hats off to your hard work.

I am a designer by trade and I am focusing on user interface and theming. I am proficient with HTML and CSS and have recently taken a class on PHP and MySQL. One of the reason I chose Drupal is because all of the backend is done. I have never used Drupal before, but now have it installed and have been playing around with the interface and modules to try and figure out how to implement my redesign.

On to the questions...
I have mocked up my designs here:
http://www.xikar.com/redesign/Final_Site/Cigar_cutter_family_page.pdf
http://www.xikar.com/redesign/Final_Site/Xi1_model_page.pdf
http://www.xikar.com/redesign/Final_Site/Xi1_individual_product_page.pdf

And have a XHTML/CSS beta template here:
http://www.xikar.com/redesign/Final_Site/index.html

I will need to change the default way that Ubercart displays the products. We are mainly a wholesale company that sells to brick & mortar stores and most of the users accessing our site come for information only, but we do some retail sales on our website. I want the "Add to Cart" button to only be on the "individual_product_page". The "Images" links on the right side will use the ThickBox gallery module. I want to have the "Specifications" table populate from a products database. Each of our products have some different specifications that should only show if we have something in the database table for that column.

What modules/strategy would you use to setup a store like this?
Here is my short list:
CCK
Content Templates??
Views
Panels??
Thickbox

If the "Xi1_individual_product_page.pdf" page was an example of a node for each of our products, can I use a teaser from each of those product nodes to create the rectangles DIVs for each color option on the "Xi1_model_page.pdf" page? Is it possible to have multiple teasers setup for the first product on the "Xi1_model_page.pdf" page that I could use to create the "Cigar_cutter_family_page.pdf" page that will show some additional teaser data? We have unique SKUs for each color option, so I don't need to worry about using Ubercarts multiple attributes feature.

We have a third party order management/inventory system from www.stoneedge.com that we use for our wholesale orders. Is it possible to export orders from Ubercart to csv format? We will probably use the www.stoneedge.com software for fulfillment and as our payment gateway for the web sales, but that's still undecided.

In the future, we would like to be able to have retail shops place their orders through the website. Is it possible to have two groups of users, retail and wholesale, where the prices are different and more products are shown?

Thanks in advance for your help,
Ben

Posts: 107
Joined: 08/07/2007
Bug FinderGetting busy with the Ubercode.

Ben,

Sounds like a great project. I would say you are starting off down the right path. My first suggestion is buy pro drupal development(if you don't already have it) by Matt Westgate and John Vandyke.

Currently, there is the ability to offer discounts based on role(Wholesale, Retail) using the uc_discounts module. You can find it in the Contributions section of the site.

I would say you are on the right track with your module list. Contemplate is very handy for custom theming. I always start with the Zen theme, then tweak it until it looks the way I want it to. Although I don't know of a way to have two separate teaser views, you should be able to use the taxonomy position manipulate the teaser view to what you desire. Example, the term has children, than the teaser output would look like Cigar_cutter_family_page.pdf. If the term does not have children, than have the teaser view look like Xi1_model_page.pdf. Check out the taxonomy module for more info. You could do this with contemplate, but you should consider using your own custom module with hook_nodeapi, and some Theme overrides.

As far as the 3rd party inventory integration, I would just write an export script to do that. Select all the orders that have not been exported, load the order, output the data, set the exported flag.

If you need more detailed information let me know.

Mike O.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Ben, I noticed you didn't get my PM from Friday, so I thought I'd repost the info here. (That way others can see it, too.)

"Just had a chance to briefly read your post and am excited about the work you're going to be doing! I just wanted to send you a quick message that I'm heading out of the office right now, but if you've gotta do some work over the weekend here's one lead - you can use the Content Templates module for individual node type design. That's what I do here and elsewhere (albeit very lightly). If you like, though, you can also create individual template files in your theme itself. I would advise you to do this because the UI isn't that great for the Contemplate module and it looks like you'll need to have good access to it. I believe the process is just creating a node-type.tpl.php file in your theme, like node-product.tpl.php for product nodes or node-story.tpl.php for story nodes. You might want to verify that through a Google search on Drupal.org, though. ; )"

Mike should be able to verify that as well, or some of the other developers here. I just think it'll save you some of the headache I run into when modifying templates. The module can be good to preview the available fields, though, so you may use it just to examine what variables nodes generate for displaying data.

For populating your tables w/ data from a database... do you already have this data entered somewhere? If not, you may consider using the product class system. You can create a new class for each type of product and then add fields using CCK per product. You can make these fields not required and then theme the output however you wish. (You could even choose to hide them and then handle the query yourself to load the data.)

Regarding teasers, these are fairly standard Drupal features. You can only specify one teaser per node. You can use a little PHP snippet to load the teaser from any page in your site and input that in a page, although I think the quickest thing for you to do will be to use a custom query.

As for the pricing difference, I believe you can use the discounts contribution to give a cheaper price based on a user's account role. If not, we should look into adding that functionality. Many folks have mentioned it in the past. Also, you can use the Taxonomy Access Control Lite module to restrict access to certain parts of your site for people with the wholesaler account role.

I don't have a CSV order export done yet, but it wouldn't be hard to accomplish. I'd be happy to incorporate any code you come up with or look into developing my own format in the future.

Basically, if you don't know a little bit of PHP/MySQL yourself, I'd seriously consider hiring someone that can do the custom queries and bits of display that will allow you to do the things you want to do. I'm really impressed with the design, and I think you'll need the custom code - it will save you a lot of frustration trying to use various modules to get the same jobs done.

Posts: 41
Joined: 09/07/2007

Thanks for the suggestions. I'm going to be working on this full time for the next few weeks. I'll play around with some of the modules suggested and work on a custom template. I need to wrap my head around what each module can do you figure out where I can use it.

I'll keep this thread updated with my progress and post more questions here.

Posts: 41
Joined: 09/07/2007

After some side project detractions, I'm back at the grindstone. I ordered Pro Drupal Development and found it to be a big help in understanding how everything fits together. I've managed to get my XHTML-CSS template into a custom Drupal theme and an fairly happy with it now. The only hard part has been finding out which function overrides I need to add to my template.php in order to get the desired HTML output formatted for my design. Now that my template is pretty much finished, I need to start tweaking the Ubercart output.

I have started to add some products to play around with. I have a question on what the best practice is for setting up my secondary navigation links for the products and creating all of the catalog vocabulary terms. If you look at my template designed I linked to above, you can see that I want a secondary navigation menu on the left that lists all of my catalog categories. Is there any way that I can create my navigation menu links when I create the catalog vocabulary terms?

After looking around for a while, it appears that I will have to create all of my catalog categories and then create all of my menu items which should be identical. I think it would be a nice feature if you could combine the menu creation form input boxes and the catalog category creation form input boxes on one page that will create both at the same time.

The other solution I can see to this would be to create a custom block that will query the database for all of the catalog categories and output a list of links.

Which do you think would be the better way to create the secondary navigation links? I'm interested in whatever way will be the most automated. Once I add a product, I want it to automatically show up in the navigation box.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Hey, good to hear back from ya. I'm curious if you've noticed that the catalog module does define a catalog block to display your catalog categories, subcategories, and even node counts if you desire. Have you seen this/does this solve your problem?

Posts: 41
Joined: 09/07/2007

Perfect! That's exactly what I needed. I knew there had to be a better way.

Here's another related question. The way my site's navigation is setup, what you call "Catalog" is what I want to refer to in my links, URLs, breadcrumbs and headers as "Products". It appears that what you call "Products" is a list of all of the products that does not show what category they belong to. Is it possible for me to rename these Catalog -> Products and Products -> All-Products. Will this cause Ubercart serious issues? Should I edit the actual module, or is there a function override that I can use? Is Ubercart setup for international languages where I can use the t('Catalog') feature that I see in some other modules to rename them?

Thanks for all of your help and quick responses.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

You should be able to rename the catalog whatever you want using either the catalog settings or the block settings (for example, to change the catalog block title to say "Products".)

Personally, I'd just disable the /products page that ships with Ubercart. You can disable it from the menu and use another solution if you really want an all products page. That's just my opinion, though... I actually don't even know if anyone is using the default products listing. Eye-wink

Posts: 41
Joined: 09/07/2007

I can't seem to override the default "/products" page when I set the Catalog vocabulary name to "Products" and change the URL in "/admin/store/settings/catalog/edit" to "Products". When I goto /products, it loads the all products page and not the catalog page. What creates the /products all products page and how can I disable it?

Thanks again,
you guys ROCK!

Posts: 41
Joined: 09/07/2007

I searched through all of the files in the Ubercart 5.x-1.0-alpha7e module and found these entries that I changed. It works now and shows the catalog on "/products". I also have a products link in the menu that goes to "/products-all".

What is the proper way to make these changes below? Should I edit the module as is did, or make an override somewhere? Do you know of any others that I should change? Do I need to change the "field_image_cache" entries below?

uc_products.module
Line 27 From:
'path' => 'products',
To:
'path' => 'products-all',
Line 1005 From:
$view->url = 'products';
To:
$view->url = 'products-all';
Line 1424 From:
'nodepl' => 'products',
To:
'nodepl' => 'products-all',
Should I change this line 169?
$items[] = array('path' => 'products/field_image_cache/'. arg(2),
Should I change this line 845?
if (is_array($node->products)){
Should I change this line 846?
foreach($node->products as $nid => $product){

uc_products.js
Line 10 From:
'nodepl': "products",
To:
'nodepl': "products-all",
Should I change this line 23?
$.post(Drupal.settings['base_path'] + 'products/field_image_cache/' + this.value, {}, function(contents){

uc_catalog.module
Line 449 From:
'nodepl' => 'products',
To:
'nodepl' => 'products-all',

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

One thing to consider is you can turn off individual menu items at admin/build/menu. You can't necessarily rename paths like you're looking for, but you can always use Views to make a custom all products listing at /products-all. For an example, see this page on bwv's site:

http://www.greystokefarm.com/store/all_products

Posts: 41
Joined: 09/07/2007

I'm not really interested in having an all products page. I would like to disable it if possible. What I really want to do is have the catalog path be /products because the catalog block uses the category term in the path for the links to the product pages. I changed the variables in the files above and it works like I want it to now. Since the old /products is now /products-all, I am free to use /products for the catalog path. Are there any negative side effects for renaming the above variables? Did I miss any?

Thanks

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

The negative side effect is that next time you update, you'll lose the changes. This isn't maintainable in the long run. From the menu administration form, you should be able to disable the default products listing URL and then not worry about it any more. Smiling

Posts: 41
Joined: 09/07/2007

I've already disabled the default products list in menu administration, but Ubercart will still reserve the the path /products for the default product list unless the variable is changed in Ubercart like I did.

Surely I'm not the only one that wants their catalog path to be /products. It's fairly common for product manufacturer websites, but I guess we're different from a typical E tailer store front.

Maybe you could commit the above changes to the next release code? Especially since you "don't even know if anyone is using the default products listing." *wink* *wink* *nudge* *nudge* All of the links and menu items will auto update the the new 'all-products' variable. So unless they have a hard coded link to the default product list, it shouldn't be a problem and a pathauto of /products/[catpath]/[title] would still work fine if someone uses that structure.

Thanks for your help on this. I'm going to start working on theming the individual product pages now.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I think I'm going to remove that page altogether and instead make that a default View for folks with Views turned on. Having Views integration in core makes this possible now.

Posts: 41
Joined: 09/07/2007

I've completed theming my products pages with a custom node-product.tpl.php. With the help I've received here, I'm really happy with the outcome. Thanks!

I'm just about finished with my model page:
http://www.xikar.com/redesign/Final_Site/Xi1_model_page.pdf

I'm using Views to bring in the custom teasers from node-product.tpl.php and then adding some HTML to the Views footer section to achieve the layout I want.

I've got one question. I'm trying to access an array that is in my product nodes located here:

<?php
print $node->content['image']['#value'];
?>

However, when on a views list, the $content variable does not load because the nodes are only sending their teaser info. I cannot do the following because $node does not have $content in views:
<?php
$node
= node_load(1);
print
$node->content['image']['#value'];
?>

Is there any way to access the variables that do not load in teaser mode other than doing a database query?

One last question, how do I get an array of all of the node IDs that should load in a given Views category? For example, I have a category "fruit" and a Views page that loads all of the nodes inside of "fruit". How can I get an array of all of the fruit node IDs?

Thanks for the help! All I have left is my main vocabulary catalog pages and I'll be done theming!

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

One thing to do would be to go to your content types administration for your product node types and click on the "Display fields" tab. Here you can turn on the images to display in teasers. This will put them in the object for the teaser... but you can simply theme the teaser to not display images if you don't want to.

If that doesn't work, you may indeed need a database query.

Posts: 41
Joined: 09/07/2007

I thought I'd post a status update since I've reached what I would consider a milestone.

I've finished theming the product pages and the catalog category list pages. I'm using a module called, Taxonomy Enhancer http://drupal.org/project/taxonomy_enhancer, to create the "teaser" text for the catalog pages. I'm using it to assign a "Basic Description" field to each category term. When you are on a parent term that has children, it will show this "Basic Description" as the "teaser" text on that catalog page. I'm using the term's normal "Description" field to display the extra text on my "Final Design Xi1 model page.pdf" page from above. It works well for what I need it to do.

I've created a theme override for theme_uc_catalog_browse() function that you can see here, http://www.ubercart.org/forum/ideas_and_suggestions/954/tableless_catalo.... Thanks Mike for your help on this!

My next goal is to setup the different user roles and figure out how I can integrate the discounts module into this along with a product warranty registration system.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Awesome. Laughing out loud I'm glad you're making good progress and can't wait to see the finished page.

Posts: 2
Joined: 10/30/2007

I have installed and used older versions of ubercart without problems. I downloaded the latest version: ubercart...alpha7e. While I have installed and configured this, I am at a loss as to how to add products to the catalog that I have designed.
Can any body help with a solution>
Thanks

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

Heh, I guess you're one of the people who used the "Add a product" link in the store administration menu.

That got taken out because there was already a place to do that in the Create Content page. Since product classes became node types, that page became more important because it was the only way to create products of different classes. We figured it would be confusing if people made product classes, but then couldn't create them through the old "Add a product" link. This also makes it feel more like Drupal because that's where all the node types are created.

Sorry for the extra confusion.