Would it be difficult to get the product elements like price and add to cart buttons available in the panel node elements?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rszrama’s picture

Based on a hallway chat at a recent Drupal Camp, it doesn't seem like it would be a big deal... but I'm not sure, b/c I don't really know what that would take. : )

himerus’s picture

I'm a bit surprised this hasn't been done yet. I'm in need of this as well. (Just started theming out product nodes) and wanted to run them in panels just for the convenience factor over theming out a new node.tpl.php just for my products and placing every item that way where I want it.

I'll have to do some debating. I've created custom panes before, but I'm not sure how badly I want to tackle this one atm. I'll debate over doing the custom panes & normal theming, and see what I feel most compelled to do at this point. I would like to get them into panels though just to be able to quickly use all the data in the same fashion cck nodes are available through.

himerus’s picture

Okay, I got a hair up my ass tonight, and have been playing with this. I have the following things functional.

  • Primary Panels 3/Ctools Integration
    • Custom Ubercart section on add content popup for panes. This ONLY shows for panels with the "Ubercart Product" relationship defined. Currently testing with the default node_view panel with a custom variant set up for my product types.
    • Ctools integration for context & relationship
    • This "should" allow assigning a product to a pane manually as well by assigning a context and then defining the NID of a product. (not tested yet)
  • Custom Ctools Content types
    • Add to cart button(s) - This is working properly, and even renders the proper uc_alternative_price button provided by that module.
    • Price
    • SKU#

It seems this will definitely be possible without too much more work. My main thought(s) about this now though is the work that is involved in setting this up, and then, looking at the way the panes are dropping into the product page(s), theming out the product pages will take me as long if not longer than creating a custom node template for products.

It also seems like there are a LOT of node loads being executed during these operations, and this could seriously hinder performance in some circumstances.

I will continue to play with this as time allows, and see how far I get. I don't know that I really want to maintain this contrib module, but we'll see how motivated I am after getting all the default ubercart elements integrated.

Considerations

I'm also thinking of what this will take to make everything available for a "simple" ubercart install like mine is, with only a couple custom items integrated into ubercart, but what happens when we start talking about product attributes, and all the additional options available by the core ubercart modules? Seems like this could turn tricky rather quickly.

If anyone is interested in the first run of code, I can post it up on github.

himerus’s picture

I did set up an open github repo for the code I've done so far. It at least gives examples of the ctools content types & how to implement those.

Github repo: http://github.com/himerus/uc_panels. I don't want to set this up as a d.o ubercart module yet simply because I'm not sure A.) how far this will go, and B.) I'm not sure if a proper implementation could potentially be wrapped into the core ubercart distro (not likely in 2.x)

Please feel free to take a look & install it on your ubercart testing environment. The items listed in my above post outline what it currently does. What I have completed currently meets my needs for panels integration, but there are a ton of other items to integrate that are out of the box ubercart. Feel free to take a clone, and do some work on furthering this if anyone has interest.

dagomar’s picture

Himerus,

seems to me your code works as advertised. I am testing, but would like to use it on a live site. Do you think that is advisable?

Thanks,

Dagomar

[ edit ]

Though it seems to work fine, I just realise you could simply create a view block for this, right?

himerus’s picture

If I'm not mistaken... (has been a lil while) the site this was developed for has not launched and is still in my personal sandbox still....

However, I think that what is here is working well from what I remember of my own testing...
I had planned (still do likely plan) to further this effort, and once it's got enough features, release it here on D.O.

I'd have to look over my sandbox and this code again to remember what all it actually DOES do... but I think what is here is safe. If you'd like to help further it along, feel free to fork it on github, and commit additions/changes/etc.

dagomar’s picture

Thanks for your reply.

I figured out this can be easily achieved with views. Ubercart exposes all this to views:
Product:

  • Product: Add to cart form
  • Product: Buy it now button
  • Product: Cost
  • Product: List price
  • Product: SKU
  • Product: Sell price
  • Product: Weight

Stock:

  • Stock: Active
  • Stock: SKU
  • Stock: Stock Level
  • Stock: Threshold

For me this is ideal because using views for node display is a road I have taken more often. I am comfortable with the way I can theme a view, and its 100% integrated with panels. In this case I have 2 views set up, displayed in a 2 column stacked panel. Left side is reserved for an ajax enabled view of an imagecache image field, right side is for product information and add to cart functionality. This method requires a bit more configuration obviously, but the (perhaps obsolete) benefit is I can use one less module. Thanks for your effords though!

bisuteria’s picture

I think that is developing the module has great potential and make things easier ...
Great idea uc_panels !!!

bluesherpa’s picture

+1 on uc_panels - great idea. Makes sense to grab all the data at once, rather than a bunch of separate queries to generate each view

coolhandlukek2’s picture

Subscribe :-)

lpalgarvio’s picture

+1

AlfTheCat’s picture

subscribing

lpalgarvio’s picture

confirmed to work 100%, although limited to SKU, Price and Add to Cart (more can be added if anyone knows how).
it's also not so simple. you need to create a Context relationship to get it working.
it's basic stuff once you know it, but took me a while to figure it out...

to get this working do this:
- edit Node Templates on Panels Dashboard
- create a variant and give it a name and layout
- in Selection rules, select Node: type from the box and click add, then choose Product and hit save (this will limit the panel to content type product from ubercart)
- in Contexts pane, in Relationships section, select Ubercart Product from node and hit Add relationship, then hit save (this will create a context relationship and enable Ubercart section in add content popup)
- in Content pane, click any gear icon, then select add content. in the popup that appears, go to Ubercart section, and voilla, you can finally add Ubercart SKU, PRICE and ADD TO CART
- add other content you might need, like the node title and image from imagecache
- don't forget to save in the end!

for Flag panels integration, go here - http://drupal.org/node/332956
and for Fivestar panels integration, go here - http://drupal.org/node/703614

all 3 are working :)

someone please add more ubercart fields and publish this as a module or commit it to ubercart :P

lpalgarvio’s picture

Status: Active » Reviewed & tested by the community
Island Usurper’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

There is no patch, so there is nothing to commit.

As for uc_panels, is it actually necessary since Ubercart already has Views integration? I suppose once Views 3 takes off, we'll have to move to CTools anyway, but right now it feels like duplication.

Even if it's not, and useful for Panels integration, I feel like it would be better off as its own module. It would be better maintained that way as I don't know anything about CTools, and I'm working towards Drupal 7 anyway.

lpalgarvio’s picture

it is a lot more difficult and cumbersome to use Views to output data to Panels.

let's start by stating that for every Column in Panels, you will need a View.
then for a additional rows with columns, additional Views.

picture this for a product page (via node templates in ctools/panels):

left side: product images, product weight, product price, add to cart
right side: node title, product sku, rating (fivestar), node body, add to bookmarks (flag)
bottom: related products, comments with ratings, etc

that's at very least 2 views, maybe 3 views with the bottom part.
if you want tabs, count with more Views (or tabs inside Views - module Tabs is at the moment buggy)
or try quicktabs or other modules

things just get messier and confusing...

ofc it would be a lot easier if VIEWS and PANELS/CTOOLS were a single module which managed both content, filtering and display, with multiple embedding views/content/blocks/etc and tabs and whatever.

the fact is that such does not exist and would be too hard and complex, and perhaps overkill, to do.

but a compromise could be achieved with
- cck fields, which already exist
- plus regular core fields pre-dating fields, which too exists...
- added up with modules distributed either with ctools OR their own module projects, to cover special POPULAR fields that some modules add (in this case, Ubercart)

resulting in less need to add Views inside Panels. much complexity would fade away.

ofc, if you need something more functional or complex, like displaying in a node, it's related nodes, you would still depend on adding up Views on top of Panels - but that need would be greatly reduced.

asides complexity, i would also point PHP script and DB performance.
it has to be faster to include these directly in Panels using this kind of modules, rather than including Views inside Panels.
that sounds to me also duplicated efforts, true, unfortunately, but also has some benefits.
it also seems rather simple to do, by looking at the code (at least for simple fields like sku, add to cart and price).

a note by a Display Suite developer:
http://drupal.org/node/908092
he thinks the integration for DS is so simple that it isn't worth a module.

i would contest that... being simple and easy doesn't necessarily means it's not worth to do it and that users know how to do it with alternative ways. part of nowadays efforts on Drupal is to minimize complexity and add usability, something that these functionality for Panels and Display Suite would provide.

plus if that is so simple to do, then that's another plus for creating the integration for Display Suite and Panels inside Ubercart, Flag and Fivestar main modules, just like they have for Views.

i would be less motivated to ask developers to do it if it was horribly complex.

Grabby’s picture

I really thought this module had saved me, but alas, it only works with the product content type. If you have numerous product classes and hence as many content types, it will work for a single product in a class, but once you have multiple products in the same class it will only pull the fields for the one whose NID you entered for the Panel context and reuse those values for all the other nodes with that content type. The bottom line is Ubercart should expose its fields to Panels as well as Views and until then arranging complex product layouts will remain as frustrating as ever! Many thanks to himerus for recognizing the problem and addressing it, however.

lpalgarvio’s picture

data as CCK fields will happen with Drupal Commerce (not e-commerce) for D7

it's an evolution of Ubercart, with a different path.

Grabby’s picture

I’m aware of the path, it’s a solution for today, and for the many days D6 will be in use thereafter, that I’m looking for!

Summit’s picture

Subscribing, greetings, Martijn

Stomper’s picture

Planned UberCart Panel support for UC3.0? I've done some theming of my product pages used a custom tpl.php, but since the rest of my site is largely panels based I would like to do the same the my product pages. I have several product classes based off of the default product classes though.

Will this work with UberCart Marketplace module?

As for Drupal Commerce, it is too new. Many users of UberCart will stick with it, and the core UC developers have no intention of abandoning UC any time soon, also there are thousands of UC users.

Summit’s picture

Hi, What would be great if also Attributes could be supported using panels.
Right now for me it is very difficult/impossible to get the attributes seperated. While Usability and look-and-feel would improve by seperating these!
Greetings, Martijn

Michsk’s picture

I would just love one page (panel page), with in the left kol a catalog, and in the right kol a direct select payment, biling and ship info and pay button.

So the whole 'shop' would be a one page shop, just how dating websites do this.

AlfTheCat’s picture

+1 to comment #23. Agree with @lasac that something like that would be really cool.

abaddon’s picture

can anyone attach the code in #4 to this issue (the uc_panels code)? it returns a 404 now.. this is why files should be uploaded to the issue not hosted 3rd party

mvidelgauz’s picture

Hello!

I wanted to try this module but link from post #4 is now broken.
Does anyone know from where it is possible to download uc_panels?

Thank you!

netivajak’s picture

I'm using a combination of Ubercart, CCK, Display Suite and Panels to do this on D6 with a product class I created.

For this exercise my Content Type/Product Class (which I created) is "Bike".

I created a new Build Mode (Site Building -> Display Suite -> Node Displays -> Build Modes -> Add new build mode) which I called "Cart Elements".

I then ONLY enable the fields "Ubercart Display Price" and "Ubercart add to cart" (Site Building -> Display Suite -> Layout -> Bike -> Cart Elements) - in this case I used the Header Region but you could use left and right to place Price and Cart alongside each other for example, but my client wanted them underneath each other so Header it was.

In Panels (Site Building -> Panels -> Dashboard) I use Node Template to create a Flexible Layout for Node Type "Bike" - but this is not necessary, you could use one of the provided layouts of course.

Where I want the add to cart (and in this case Price) to appear I used "Add Content" for the applicable Region and selected Node then Node Content.

The important moment arrives! I selected my Build Mode called "Cart Elements" and unchecked all the other options.

Price and add to cart buttons available in the panel node elements - indirectly perhaps, but done.

On the shoulders of giants as they say.

lpalgarvio’s picture

you don't need display suite. use only panels.

create a view pane (or multiple) and place the fields on it.
add:

Node: Nid
in Arguments

and:

Node: Nid source: from panel argument
Panel argument: first
in Argument input

then on panels, add the view pane you just created.
and place nid for argument.

lpalgarvio’s picture

uc_panels i currently use.

netivajak’s picture

@LPCA agreed re:views/panels - but I have found that some people do struggle with Views (and Panel arguments) so I looked for an alternate method using Display Suite and Panels so that there was a more "visual" method for my clients and they could better understand how the site is constructed. Another advantage (imho) is not using alpha or dev modules. Downside of course is using more modules.

lpalgarvio’s picture

panels for 6.x is stable; for 7.x is alpha, but reliable.

you can avoid all together uc_panels by using views, but it will demand more resources. it would be optimal to get this code in ubercart,

TR’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

As Island Usurper said in #15, this can be done and should be done in a contributed module. I agree. If and when usage of that contributed module demonstrates that this is a vital feature to put into core Ubercart, then we can consider it.

However, there seems to be little interest and no one willing to publish and maintain uc_panels on drupal.org, so there's little incentive to incorporate any of this into Ubercart where the Ubercart maintainers would have to support this code that they personally don't use.

lpalgarvio’s picture

that kinda makes sense since ubercart is plagued with <strong>s and <em>s all over the place, and there is an awesome lack of usage of CSS classes and ids. it does not give much hope to designers and themers when the UI and styling is not fixed over the course of years and efforts to mitigate problems and improve the module are ignored like this. i really thought that would change with 7.x... haven't seen that yet.
thanks

longwave’s picture

@LPCA: apart from #556458: HTML (strict) validation fails: convert nowrap attribute to white-space: nowrap CSS which HTML and CSS issues are you talking about? I am willing to help improve things like this but if they aren't reported, we don't know about them! Suggested improvements for HTML and CSS are welcome (in new issues, not this one)

longwave’s picture

Also looking at that code it's fairly simple, if it was cleaned up it could well be added to Ubercart core I think.

lpalgarvio’s picture

from what i recall right now,

shopping cart block for example. all of it.
lots of text, labels and fields without classes/spans/divs
#904986: Provide CSS classes for empty cart text (and call theme function). Patch included

and total label and field in /cart.
another strong, instead of a span with a class.
#1014782: Subtotal in bold/strong at checkout page

at /checkout, the strong is replaced with a span+class as of the -dev.

TR’s picture

@LPCA: There are a whole bunch of issues tagged "Ubercart theme layer", as well as a bunch of theme issues that aren't tagged yet. If those things concern you then help out, don't just complain that no-one else is doing the work. I've personally volunteered thousands of hours cleaning up some of the crappy code left behind by the original author of this project - what have *you* done? As far as I can tell, you haven't even bothered to report those problems you think are obvious(<strong> and <em>), let alone propose solutions, create patches, or test patches. I've made an effort to re-open and tag theme-related issues over the past year, and I've repeatedly asked for help from "designers and themers" in those issues. There's been little or no response. Specifically, I don't see you helping out in those issues at all, so in this case you're part of the problem, not part of the solution. I explicitly asked *you* to try out a patch about two weeks ago, after you had commented "+1" in an issue awaiting review. You didn't bother to help.

And as far as uc_panels go, you seem to feel that volunteer maintainers like myself have an obligation to provide free development time to address your needs. We don't. If it's important to you, why don't *you* take on the responsibility of posting and maintaining the uc_panels project? Or why don't you sponsor @himerus or someone else to do this? Or are you just someone who takes from the community without ever giving back? No one is ignoring you or stopping you from doing this - you just seem to want someone else to do it for you for free rather than doing it yourself. I guess it's not important enough to you to actually spend your own time or money working on it.

lpalgarvio’s picture

i actively post issues when i find bugs/problems/missing features, whatever the module is.
http://drupal.org/project/issues/search?text=&projects=&assigned=&submit...
granted many are subscriptions, but many are also reports of actual problems, or even patches.

did report some for ubercart too, and of them is this issue - #1014782: Subtotal in bold/strong at checkout page. one about strong tags.
given that there are many strong/em lying around, it probably would be a good idea to find them and add those lines of code to a todo list than open an issue for each one of them.

i'm not a 100% programmer, more an admin, themer and builder, however where i see fit, i do provide code, patches or any efforts i can, even though my time is limited. the last code i provided was likely sample views for views_system, a week or so ago.
#1196462: Predefined views for Drupal 6 Views 2 with code
#1196064: Predefined views for Drupal 7 Views 3 with code

i'm guilty of not developing/helping for ubercart much, but i did so for other modules of interest. i also helped a lot reviewing modules, and at similar module review group. at the moment im building Features to make available for the general public.
but why are we discussing pointless things? i'm not saying i'm better than you or that you don't work or are a slacker or anything...

regarding uc_panels, after a year or so on this idea, code, patches and testing, now you come forward and say you don't want it in ubercart? then why didn't you say so 1 year ago? perhaps by then, the module would have been created and properly supported, instead of having the code laying around, abandoned.

that is really frustrating for users.

and regarding that, i still don't believe the best approach is to have a separate module.
lots and lots of modules have included support for other API modules, like Token, Views, CTools/Panels, Rules and Features, by including the code in the main module, or as a sub-module, or even as a contrib module, to be tested, and then merged in.
i think the testing period has elapsed. never had an issue with this code, and i'm using the -dev, not the v.2.2 like stated in the issue.
CTools support for Flag, for instance, started as a few patches, then someone bundled them as a module, for general testing, and now they are providing what looks to be the last patches to get it in Flag module.
#332956: Flag Ctools integration

seanr’s picture

FYI, I posted a D7 version based of LPCA's code here:

http://drupal.org/project/uc_panels

I'm using that on a site right now and it appears to work well.

Stomper’s picture

Please share the site/demo

lpalgarvio’s picture

oh, i'm not the author. someone else coded it but i don't recall in which issue i found the code.

philsward’s picture

I too would love to see the core of Ubercart include some love and support for panels, but alas, I was left to testing out the himerus-uc_panels-6.x-1.0-alpha1.tar.gz posted above. Much to my surprise, it works beautifully even on UC 2.7! I was quickly disappointed though as it only tied in the relationship to Price, SKU and Add to cart button, leaving out (what I believe to be very important) Weight and Dimensions. I initially tried creating a custom content pane with some php code to call on those items, but it wasn't playing nice and since I don't call myself a programmer, quickly gave up. Next, I decided to check the code in the uc_panels and much to my chagrin, the module is laid out beautifully in a plugins style format that allowed me to copy the uc_price.inc plugin over to uc_weight, change the necessary stuff and voila! I'm honestly surprised it worked for me on first try, but regardless I have compressed my findings and would love others to confirm it works as expected.

Any idea what this would take to get a 6.x branch going on the UC Panels project page?

longwave’s picture

Status: Closed (won't fix) » Active

This isn't that much code so I am willing to get basic panels support in core, if the demand is there.

philsward’s picture

@longwave, I have a feeling the demand is there, just not a lot of folks mentioning they want the feature... BTW, thx for offering to help out with this :)

I just got done trying to incorporate the uc_breadcrumb but wasn't successful :( That's where my lack of php knowledge gets the best of me.

From what I can tell, the things that aren't available that might want to be added are:

Catalog (see notes below)
Product List Price (MSRP)
Product Cost Price
Catalog Breadcrumbs
Image Widget (same formatted image widget that is stock to the Ubercart image display on a product node, large image at top, smaller below)
Update 2011/12/18: View Comment #7 for additional ideas of data to expose.
Update 2011/12/19: Add "Product Kit" data fields (product list, qty, weight etc.)

I think that's just about everything that might be desired at this point?
For the prices, I thought maybe a select box could be used for a generic "Price" pane where the respective prices are chosen from the pane configuration screen instead of having to code a pane for each one. (I hope that makes sense, it's late and I'm getting tired.)

Catalog Notes: I currently use a custom content pane with the following to get my catalog to show up in panels (would much rather see it in uc_panels (or) core):

<?php
print theme('uc_catalog_browse');
?>

Long term idea would be to setup the catalog where a respective catalog term could be selected and shown on a pane. (wouldn't hurt my feelings if this didn't get much love...)

<?php
print theme_uc_catalog_browse($tid = 17);
?>

(Where 17 is the catalog term ID number)

longwave’s picture

Well first steps is to get the existing code from #42 merged into uc_product; it doesn't need to be a separate module. Once that is tested, we can start thinking about adding more features - but the above list look like good suggestions to me.

philsward’s picture

Sounds good. The only thing I forgot to do, was change the class for the dimensions and weight contexts. Because I copied the "price" context, the display class followed with it.

$uc_context['class'][1] = 'display';

I'm sure that will get pulled out if it's merged into core, but thought I would share for anyone wanting to do some theming to the above alpha2.

AlfTheCat’s picture

@longwave there's demand here :)

Stomper’s picture

demand

philsward’s picture

OK, goodie time! I paid to have someone extend the functionality of the above proposed module and added a few tweaks of my own.

Note: Known to be working with Ubercart 2.7+ (Unknown results on previous versions)

What's Working:
Ubercart: Add to Cart Link(s)
Ubercart: Catalog
Ubercart: Catalog Breadcrumb
Ubercart: Product Dimensions
Ubercart: Product Image
Ubercart: Product Price
Ubercart: Product Weight
Ubercart: SKU#

Notes:
Ubercart: Add to Cart Link(s) | If you enable panels for both products and product kits, then by design, the "add to cart" link will automatically detect if the node is a product or product kit and gracefully show the list of products that are being added to the cart on a product kit, assuming the As a unit. Customers may only change how many kits they are buying. List component products. is used for the kits. (I don't know how they show up if the other options are used). It will also show any attribute options you have enabled for a product as well.

Ubercart: Catalog | In the pane settings, you are given the option to choose the overall catalog grid, or a specific category. I will note that the developer noticed some issues with the url's pointing to the term path instead of the alias when using a specific category, but in my (brief) testing, the url path's all looked fine. (using pathauto)

Ubercart: Catalog Breadcrumb | Depending on your theme, you might have to hide the default breadcrumb using css or creating a custom product tpl template to remove it. Otherwise you might end up with two breadcrumbs, one being pretty generic. On the flip side, if the breadcrumb isn't showing up, it might be due to some css that is already present in your theme.

Ubercart: Product Image | The product image is the exact same widget layout as the default product image widget. (big one on top, little one's below)

Ubercart: Product Price | The product price will give four options to choose from when adding this pane.
- List Price
- Cost
- Sell Price
- You Save

If you want a list price pane and the sell price pane, you will need to add Ubercart: Product Price two times and choose the respective price field from the settings, each time you add it.

You Save - Let's talk about this feature... It takes the "List Price", and subtracts from the "Sell Price", to give the "You Save" amount. Keep in mind that if you want this feature, you will need to add all three panes. I had this added in to fill a marketing need of "regular price, current price, you save amount". Many sites are now marketing with this approach because it makes people psychologically think they need to buy something because it is listed as cheaper than before and since they don't know if it will go back up to the regular price, they make an impulse purchase. (I'm guilty of this...) Just take a look at the products on amazon.com or newegg.com and you will see what I'm referring to.

List Price - When using the "you save" feature, I ran into some issues where a product had the list price set to $0.00 and would show up accordingly. This would do some goofy stuff with the "you save" pane, throwing in an ugly negative number... By design, If you have the list price and sell price panes both enabled, then the list price will ONLY show up if it is MORE than the sell price. Otherwise it is hidden. Same goes for the "you save" pane if it is enabled along with the list and sell price panes. I will note that if for some reason you need the list price to show up regardless of being less than the sell price, there is an option you can set in the settings when you create the pane, to have it forcefully show up.

---

This has NOT been tested with any product classes... I don't see why it wouldn't work for them, but keep that in mind.

For basic installation, see comment #13. (Basically enable and make sure you add it as a relationship in the panel variant context)

AlfTheCat’s picture

@philsward you rock! This all sounds great, thanks so much for sharing your contributions. I can't wait to give it a spin and play with it, I love the you save idea too!

richH’s picture

Oh Excellent!!

@philsward : you don't know how happy you just made me!

Thanks so much for the excellent module.

TR’s picture

Version: 6.x-2.2 » 7.x-3.x-dev
Component: Code » Module integration

@philsward: Would it be OK if I took the code in #49 and made it an official module on Drupal.org?

This isn't going to be put into the Drupal 6 version of Ubercart because of the dependency on CTools. Drupal 7 Ubercart already has a CTools dependency, so I'd like to put this into Ubercart for 7.x-3.x. The Drupal 6 version can be / should be maintained as a separate module.

Moving to 7.x-3.x.

longwave’s picture

@TR: I don't see why this can't be merged directly into the relevant 6.x-2.x module(s) without a dependency; it would just automatically become available once someone installed Panels.

longwave’s picture

IMO the code could do with some cleanup before integrating it, though

TR’s picture

Assigned: Unassigned » TR

Hmm, yeah - I got fooled by the .info file saying ctools was a dependency. You're right that it's not a real dependency, just like panels isn't a real dependency.

I've done some cleanup and I'm going to test the code in 7.x-3.x as part of the uc_product module. I'll post a patch.

philsward’s picture

@TR From my standpoint, I've posted the 6.x version for anyone to use as they see fit. I would LOVE to see this type of stuff used and implemented somewhere else : )

If I had my wishes, the 6.x version I posted would be used as the 6.x port out on http://drupal.org/project/uc_panels but on the same note, if the plan is to integrate these features into the core, that's even better : )

I know a lot of us will be very glad to have this capability in ubercart core.

TR’s picture

@philsward: Oh, I missed seeing #39 where @seanr said he already posted in on d.o.

OK, so my plan is to make a patch for this in D7 core, then backport that patch to D6 after it's been reviewed and committed. The backport itself is trivial...

philsward’s picture

@TR Yeah, I don't know how "up-to-date" the d.o. 7.x version is in comparison to the 6.x version I've posted. Either way, I know there will be some work involved in stepping it into core. I have a feeling the 6.x version I posted is a lot more feature rich than the 7.x version but I haven't tried it so I can't really say. I hope that you can at least take a look at the 6.x version and incorporate some of the ideas as you go : )

TR’s picture

@philsward: I started with what you posted in #49 (since I didn't know about that other project), so I have the latest.

philsward’s picture

Sounds good! I'll keep quiet and let you work your magic : )

rootwork’s picture

I had a bit more complicated usage -- I had a panel that displayed a node, and in that node was a node reference to a product, and I wanted to grab those product fields and display them. For my usage, all I needed to pull in was the price, so I didn't mind doing a view for the pane, and the module seemed a little overkill.

So I just wanted to update #28 with the method I used, in case others are trying to get this in via node reference.

Parts you will need:

Drupal 6.x
Views 2.x
Panels 3.x
Ctools 1.x
Ubercart 2.x
Content (CCK) 2.x (w/Node Reference enabled)

1. Create a view with a content pane
2. Put whatever fields you need to be displayed.
3. Add an argument for Node: Nid. Accept the default values, i.e. "Display all values" when argument is not present, "Basic validation" under validator, and "Hide view" under invalid argument.
4. On the content pane display of your view, under "Pane settings" is an option for "Argument input." Click "Edit."
5. Under "Node: Nid Source," select "From context." Under "Required context," select "Node ID" (in the "Node" section).
6. In my case, I also added a node type filter to the product type and set the items to display to 1 (since I'm only grabbing one field) to try to speed up the query.

Go over to your Ctools panel-page.

1. On the "Contexts" tab, add a context for "Node from reference" and give it a name. Select the node reference field (from a drop-down if you have more than one).
2. On the "Content" tab, add your view pane.
3. In the drop-down "Argument (Nid)" field, select the name of your node-reference context.

And that's it! I know this is probably a pretty specific use case, but I thought I'd put it up anyway in case it helps others.

AlfTheCat’s picture

Using the module from #48 I only get 'Catalog' in the Ubercart category in panels' page manager ui. I can't add any other panes as described in #48.

Does anyone have a thought about that? I'm using the latest dev of ubercart (6.x-2.7+120-dev)

philsward’s picture

I'm not using the dev, but it works fine for me. I'm using the table list of my products and if I set it to a specific catalog category, it shows the products that are in that category. What does it do when you choose a category vs the "show all"?

lpalgarvio’s picture

uc_panels works fine (tested) on a drupal install with ubercart 6.x-2.6 (or dev dated sep/oct 2011) and panels 6.x-3.8 or later. it has worked fine for at least over a year

incognito for uc 6.x-3.x or 7.x-3.x.

nicxvan’s picture

I get a white screen with the message: Fatal error: Only variables can be passed by reference in /home/directory/public_html/sites/all/modules/ubercart/uc_product/uc_product.module on line 1330

When I try adding a price to the panel.
Ubercart 7.x-3.0
Panels 7.x-3.0-alpha3
ucpanels 7.x-1.x-dev

TR’s picture

@nicxvan: If you have a problem with http://drupal.org/project/uc_panels, then the proper place to post that problem is in the issue queue for that module.

sbydrupal’s picture

For Drupal 7, price and add to cart fields appear in Panel Node Template yet doesn't seem to work. My purpose is to
use the Panels Node Template to customize the product pages and just insert "price" and "add to cart" buttons.

Will be appreciated if somebody shed light on this issue. As I remember, panels node template used to work with add to cart without any issue automatically for Drupal 6. Anything changed for Drupal 7 ? Why there are UC fields available in the panels node form template if it is not working.

UC_Panels works (with price plugin fix) for price and add to cart. Thx for this module.
Will default behavior work in the future without UC_panels for version 7 similar to version 6 ???

Thx much!

sbydrupal’s picture

In addition, for theming purposes, Panels Node Edit form page doesn't receive ubercart price, sku, ...

Thx

nildar’s picture

It seems to me i have found solution for Drupal 7.
Apply this patch to the Chaos Tools Suite (ctools)

Sorry my bad English.

philsward’s picture

nildar's patch worked for me.

I didn't actually patch the file, I manually entered it but I had to put the patched code BELOW:

 // Invoke the view-hook to get the extra field.
  $entity->content = array();
  $langcode = $GLOBALS['language_content']->language;

From what I can tell in the patch file, the code is supposed to be above that. It wouldn't work because the variables weren't called on yet? I can't program so I don't know what the difference is...

Regardless, I just updated to ctools 1.2 and still had to add this code to get it to work. Crossing my fingers that it doesn't cause other unknown issues...

philsward’s picture

This still isn't fixed in ctools 1.3

I can confirm that updated code from patch in comment http://drupal.org/node/658732#comment-6128076 does still work

AlfTheCat’s picture

patch #69 no longer works. Getting an error:
Notice: Undefined variable: langcode in ctools_entity_field_extra_content_type_render() (line 102 of /var/aegir/platforms/.../sites/all/modules/ctools/plugins/content_types/entity_context/entity_field_extra.inc)