4 replies [Last post]
littlegeek's picture
Offline
Joined: 11/04/2007
Juice: 46
Was this information Helpful?

Hello,

I would like to add CCK fields to uc_product_table. For this, I created a module and the _table_alter hook function.

However, the catalog can be displayed on multiple pages: how to synchronize the "data" array and the data actually displayed ? We should be able to retrieve data before posting, knowing the number of items per page ...

And similarly, how new field can be sorted ?

thanks in advance !

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Catalog page and hook_table_alter

I don't know what you mean by "synchronize". uc_product_table(), and all of the table_alter hooks that change it, get an array of nids as an argument. Doing a node_load() on these nids gets you all of the data associated with that node, including CCK data. It's up to the process that calls tapir_get_table() to decide exactly which nids to pass, and in which order.

Thus, it's very hard to sort on the CCK values. You end up needing a query builder like Views to create an SQL statement with the right ORDER BY clauses for the tablesort code. In fact, I had to modify TAPIr just to get the tablesorting that's there to work. By 2.0, I'll probably have replaced the product tables with special Views code to be more dynamic and useful.

littlegeek's picture
Offline
Joined: 11/04/2007
Juice: 46
Thank you for your reply. I

Thank you for your reply.

I finally found a solution with the views module.

In any case, Ubercart module is great, thanks!

However, if I may comment about Ubercart , I think it lacks a bit of flexibility. In seeking to many wysiwyg you end up limiting the creator of the website. For example, I would rather create a system of template (on the same idea page.tpl.php, node.tpl.php, ...) for all viewable areas: shopping cart, page product catalogue ... Overall, it would have been more flexible to make changes.

But it is only my opinion ! Eye-wink

(Sorry for my pitiful English ...)

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Thank you for your reply. I

Glad you got it working, but I'm not sure I understand the flexibility issue. It sounds more like a general Drupal issue than a limitation imposed by Ubercart. If this is what you mean, you'll be happy to know that what you're looking for is entirely possible in Drupal 6. In D6 I'm pretty sure we can break theme functions for any part of a page out into template files like this.

littlegeek's picture
Offline
Joined: 11/04/2007
Juice: 46
Yes, I think that this kind

Yes, I think that this kind of functionality is very useful!

Otherwise, I discovered by chance the module contemplate that allows exactly the sort of changes I want ... Eye-wink

Thanks for your help!