15 replies [Last post]
jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Was this information Helpful?

Hi you all.

I upgrade here a modified version of the uc_products.module which adds a new block under the node body with a horizontal block (with horizontal scroll) which shows all the rest of products on the same category on a nice look which is not very common but it's a request for a project I'm developing. On every product node opens a horizontal block of a fixed with with list all the other products inside the same term (so, the same branch on the catalog tree).

If someone wants to have it check and send comments it will be appreciated to see if we can polish it. It now shows a div which on only allows horizontal displacement. It has been tricky and it's working pretty well, but for adapting it to a new theme maybe some adjustments will be required on width and heigh tags. Backup your previous uc_catalog folder and subtitute files, it won't hurt your systems because it does nothing to the data, it's only displaying funtions.

It's not a functionallity for everybody but it looks nice and not many shops have such a view.

Have fun and send your comments.

PreviewAttachmentSize
on-same-01.gifon-same-01.gif9.84 KB
uc_product_jtr_v021.zip21.19 KB
jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: uc_products modified for "On same category" block

New version, new fetures, better code:

  • all the functions have been added without interfering the original ones in any way (so, safer to test and restore if you don't like)
  • now it works as regular drupal blocks and has to be accesed form block admin page
  • two configuration parameters inside the block admin page
  • now lists as horizontal scrollable box or a list of items with name, sku and price (selectable from block admin page)
  • block admin page lets selecting which vocabulary you prefer to use to search other items on the same category, maybe you want to list the rest of products inside the same category on catalog vocabulary, maybe you have other vocabularies as alternative classification forms and you can use them (is a good choice considering that you can have the regular catalog block always on your side bar)
  • title of the block is changed on the regular text field on the block admin page
  • if no items are found on that vocabulary at least lists products on the same vocabulary, if any displays a no results were found message

I hope you find it interesting and send your comments Smiling

AttachmentSize
uc_product_jtr_v034.zip 21.75 KB
jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: Re: uc_products modified for "On same category" block

BTW, I would like to add that this is a feature that could be achived with views and some cck fields, but obviously it wouldn't be easier for newbies or non-tech people. That's why I've tried to suggest it as a feature for the kind of people that expects to find that feature integrated on the software.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Jordi, With all these cool

Jordi,

With all these cool blocks you've been building, I almost wonder if they should just be made into a single core module instead of added to several different core modules. Perhaps a single "Uberblocks" module that could define all these different blocks for an Ubercart store to use based on what modules they have enabled (using module_exists() in hook_block()). Have you considered this? Then when folks come up with new versions, we can get them to patch against this module, and there will be a single module to go to to make corrections and updates.

This solution would also help to keep core clean and smaller for the folks like you mentioned that would rather build their own blocks w/ Views or something.

What do you think?

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: Jordi, With all these cool

I understand your position, but the kind of things I'm trying to add are very basic from a code point of view and very appealing from a marketing point of view. I don't plan to add more blocks, what else could we add? It is not "basic" having a "special offers" block and mechanics? Laughing out loud

I'm against dozens and dozens of modules that increase the size of ram needed on the servers and forces the drupal system to verify dozens and dozens of files on disc, which reduces performace and penalizes our servers from the ISP point of view...

Also, I would see a very non-drupal vision on an only-blocks module when I think that one of the top-notch things about ubercart is its very-drupal vision.

But I understand that for the uber-team is better to have a controlled size, which means easier to mantein code and better future possibilities for new upgrades.

I know that I've been providing several new features related to the visualization area. They got mainly suggested by my client, who couldn't approve an e-shop without:

  • a grid list visualization for products, more attractive when considering sites displaying beautiful pictures of products, at least alternative to the list view
  • a "special offers" block with some mechanics to mark products as "offer (of the month)"
  • a "best sellers" products, which shop doesn't want to attract attention to new buyers, for example to the most wanted products by the rest of buyers
  • some kind of listing of "other products that could be interesting for you" on the same category or others categories, some sites display a "buyers who bought that also bought" who could be easy to add as a feature inside that new block

I'm not trying to convince you or to convince anyone, just trying to offer arguments that justify if those elements are logical to be on core. I think is not only important but even more, very relevant, offering not just "flashy" things to fill my pages, but very important e-marketing tools that makes a shop much more relevant among its competition. Ubercart should provide that to users who have no skills (on views or other drupal amenities). With that e-marketing point of view ubercart would not only be a very interesting add-to-cart engine but a sensitive e-shop system.

I'm a drupal consultor and web sites integrator. I talked to you in Barcelona that I'm planning a new CRM system for drupal, and my plans are to integrate it with ubercart, probably as a side project, I will write soon more to develop such idea and project (there are some points I would like to discuss with you). As an integrator I could have developed those 4 mentioned features for my customer's site and forgot about it, but I have exposed them here because I thought it was my way to be grateful with the rest of ubercart and drupal developers. Now it's up to the uber-team to decide if they are worth to be part of core or not. If you want my compromise to mantein those blocks on next versions you can count with it Smiling

I just hope my english is good enough for such a long explanation Eye-wink

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: Re: Jordi, With all these cool

Ryan, to make the thread more clear I want to point something on a new message.

Returning to the new addition here on the uc_product module, I would like to point to the fact that the new additions are just for functions not interfering at all with the rest of the module or the system:

  • a block_hook that was not previouly, with its own config parameters inside the block, and with the fact that if people don't activate it won't be bothered with something they don't want
  • a function that simply displays a list of other related nodes (a simple ul list) with a non very complex select
  • another select to display products on a visual grid
  • a theme function for the last one

What I mean is that I think is a "safe" addition that won't broke delicate parts of ubercart. You can delete those functions and the module is exactly what it was before they were added Smiling

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Jordi, With all these cool

I'm not worried about the usefulness or functionality of the code, but I'm wondering about the main use of the modules. For example, the catalog module is supposed to provide new users with an easy to use catalog out of the box for product navigation. The new blocks you've added are great additions to the Ubercart core, but someone may want access to them without actually using the entire product catalog. The product module, in this case, is really meant to define products and is not really concerned with their relationships to one another or orders. My proposal would move your blocks, which seem to be centered around product marketing, to a core module that either holds generic extra features or even just defines a set of blocks to use with Ubercart depending on the modules you have enabled. Encapsulating the blocks in their own module would seem to be in line w/ Drupal's idea of separating core systems from modules that offer enhancements/interactions (i.e. node is separate from book/forum), and shipping the module with core won't make it any harder for newbies to access and use the blocks.

Does that satisfy your concerns?

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: Re: Re: Re: Jordi, With all these cool

Ok. Wouldn't be ilogical having a module for "marketing blocks"...

Then we could place on that module "best sellers", "special offers", "find also on that category" and "who bought that product also bought" blocks. Forth is something which I'm preparing and two first are very related with the last "approved" uc_catalog and it's new grid display, since both relay on that grid functions and have many features on the catalog settings page. What do you prefer, splitting this two blocks from catalog to uc_marketing.module? Uhmm, do the grid stay on uc_catalog as a core feature, or you want it also splitted on uc_marketing.module?

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: Re: Re: Re: Re: Jordi, With all these cool

After re-reading my last I would say that the grid for catalog would be better be part of core uc_catalog. That was the main reason from my original port from a separate module to uc_catalog itself, since from certain ubercart version it didn't worked. What do you think Ryan, Lyle?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: Re: Re: Jordi, With all these cool

Oh, I think the grid views are perfect in the separate modules, but moving the blocks you've already done and plan to do to a separate module would be great.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Re: Re: Re: Jordi, With all these cool

I think it's good to leave the grid in the catalog module. I might refactor it out into two different theme functions though. I think that would make it easier for designers to work with it to make changes.

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: Re: Re: Re: Re: Re: Re: Jordi, With all these cool

Great Lyle, I agree that the grid is a good addition, if you uber-optimize will be great Smiling

Ok, I'll build a new module with all these blocks and maybe even some more. Any suggestion for the module name? Cool

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Re: Re: Re: Re: Re: Jordi, With all these cool

uc_marketing is what I was going to use. It never went anywhere so you can have it.

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Ok. BTW, Lyle, when you

Ok.

BTW, Lyle, when you refactor the grid function would allow us to pass it a variable for the mysql LIMIT parameter? (This is something I add on the last version and it parametrized on the setting page both for the "best sellers" and the "special offers" block) It would allow us on grid not only to decide the width but also the number of rows. It would be great if to be a parameter to that function since that way we could decide to have differente grids for different blocks.

mimetic2's picture
Offline
Joined: 08/07/2007
Juice: 478
Re: Ok. BTW, Lyle, when you

When I installed it and put the "same category as nodes" blcok enabled, i got this error:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND n.status = 1 AND n.type IN ("product","type_of_paper") ' at line 1 query: SELECT DISTINCT(n.nid), n.sticky, n.title, n.created, p.model FROM node n INNER JOIN term_node tn ON n.nid = tn.nid INNER JOIN uc_products AS p ON n.vid = p.vid WHERE tn.tid = AND n.status = 1 AND n.type IN ("product","type_of_paper") AND n.nid != build ORDER BY n.title in /home/loopske/public_html/includes/database.mysql.inc on line 172.

jorditr's picture
Offline
Getting busy with the Ubercode.
Joined: 10/31/2007
Juice: 256
Re: Re: Ok. BTW, Lyle, when you

Hi mimetic2, it looks to me it has some trouble with the class "type_of_paper". I see also a "n.nid != build" which I quite don't understand. Does it happens with every node or only with some nodes?