By jrchew on
Hi everyone,
I am working on a project that takes advantage of Drupal, Ubercart, and the UC_upsell module, located at: http://earcandles4u.com.
My issue is with UC_Upsell. In my upsell block I need to list items in order by title.
I've been searching through this module's code, specifically looking for a MySQL query that I can manipulate but have not found much. Can someone point me in the right direction?
Thank you very much in advance.
JR Chew.
Comments
I found the query to pull
I found the query to pull these related products.
It looks like this query doesn't involve the title field at all. The query looks for the NID field and from there it references the uc_upsell_products table to find stored associations.
The query doesn't involve the title field therefore cannot be sorted by title.
I'm thinking that writing a separate function to find titles based on id's would be the best way to go about this.
What do you think?
add title to the query and
add title to the query and sort them using sql command?
--------------------------------------------------------------------------------------------------------
if you can use drupal why use others?
VicTheme.com
Ok, so I dissected the core
Ok, so I dissected the core and began writing a "find_titles" function when line 202 of uc_upsell_core.inc caught my eye. All I needed to do was comment out that line and I've got my solution. Products are in order.
By commenting out this line products are listed by their NID. This works for me because of the order in which I created products in Ubercart.
If anyone else runs into this problem and needs a more official way to order things, make your voice heard here and I'll contribute what I started on.
jrchew I need to list related
jrchew I need to list related products by title. I can't rely on NID like you because of the way I created products. Do you have any guidance on how to do this, since you've looked into it fairly thoroughly it seems? Thank you. (I also think this should be a feature in the module eventually)
You could post an issue or
You could post an issue or feature request on the project page. I'd be willing to add this as a feature to the module itself.
http://drupal.org/project/uc_upsell
Have I helped you? Consider buying me a beer.