20 replies [Last post]
oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Was this information Helpful?

What is the name of of the form to alter when I want to add something when certain options are offered in selection?

Let's say i got attributes dates, so i want to alter the date output THERE into a nice format just for display, hence no changing on db level?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Altering form 4 Attribute/Options

I recommend grabbing the Web Developer extension for FireFox. It adds a very cool toolbar with options to see information about the current page. For example, you can turn on a display of form information and see the names, IDs, types, values, etc. of all forms and form elements on the page.

The attribute/option widgets are part of the form "uc_product_add_to_cart_form_##" where ## is the nid.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Altering form 4 Attribute/Options

I think you want 'uc_product_add_to_cart_form'. You need to be careful in using hook_form_alter on it, though, because the attribute module uses hook_form_alter too. Your module will need to affect its weight so that it will be processed after uc_attribute, allowing its changes to be the ones that matter.

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
You want code?

Look, i simply set up a pane for during checkout (after the exampel of uc_lead) where i pickup
greetings text for my gift certificate, which i scan the cart for if that node is in by model sku.
it comes on great for all products, but when i check on $order->products which is $arg1->prodcuts,
then the $order is empty until i click on review browser button backwards. I doublecheck this
with print_r $order!!!

if you have any alternative to get my greetings text for my gift product let me know, or still
explain to me why it does not work... also, how do i store the greeting like $order->greetinz =""
in my actual order, so that I can use it later on when the order is donw to be sent via email as well?

do you know when the coupon module is updated to the current 7e or how to rename some functions there???

function myodule_checkout_pane() {
$panes[] = array(
'id' => 'any_id',
// 'callback' => 'mymodule_greetingz',

'title' => t('...'),
'desc' => t("..."),
'weight' => 1,
// 'process' => TRUE,
// 'collapsible' => FALSE,
);
return $panes;
}

------

function mymodule_greetingz($op, &$order, $data) {

// echo $order->order_id;

// if ($order->order_id < 1) {

// print("orderproblems......");

// return;

// }

$display = FALSE;

foreach($order->products as $key=> $orderitem) {

//echo $orderitem->order_id;

if ( ($orderitem->model == "gift1") || ($orderitem->model == "gift2") ) {

$display = TRUE;

}

}

print_r($order);

if ( $order == '') {

drupal_set_message( ". order empty!!!" . $order->order_id);
}

if ( $data == '') {

drupal_set_message( ". form empty!!!" );
}

$pc=count($order->products);

switch ($op) {

case 'view':

if ($display) { return $contents for pane} .........

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: You want code?

Hey man... if you want to get some code help, you're just going to have to post up the actual code. It's impossible for me to tell if you're not just misspelling stuff because it's all so inconsistent. Post up the code wrapped in PHP tags so it will format like this:

<?php
 
// Nice and pretty.
?>

Then if anything sticks out as an error, we'll try to point it out.

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
ur funny!!!! the code works

ur funny!!!! Laughing out loud

the code works since there is no error, all what happens is that $arg1 is getting no feed ..

And the code is "nice", Mr. Legalist Eye-wink Is is the start of a function checkout pane calling a function, period, there it goes on $order->products to scan thru the model of each order item and if it is a certain flag $display = true to return the $pane, else return nada and go on with Drupal life ...

When i go to order review and then hit browser back button, i happen to get the $order filled in the pane to make its calls...

I still would assume it is something core, since the pane goes up if I set the $display flag on true but as I sad to make a case I need the $arg1 which is empty. Sad No more ueber-cart ??? this cart is Puzzled

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Re: ur funny!!!! the code works

function myodule_checkout_pane()

{

$panes[] = array(
'id' => 'any_id',
'callback' => 'mymodule_greetingz',
'title' => t('...'),
'desc' => t("..."),
'weight' => 1,
// 'process' => TRUE,
// 'collapsible' => FALSE,
);
return $panes;

}

------

function mymodule_greetingz($op, &$order, $data) {

$display = FALSE;

foreach($order->products as $key=> $orderitem) {

if ( ($orderitem->model == "gift1") || ($orderitem->model == "gift2") ) {

$display = TRUE;

}

switch ($op) {

case 'view':

if ($display) { return $contents for pane} .........

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: ur funny!!!! the code works

You're kind of proving my point here... look at your very first function name, myodule_checkout_pane(). I don't even know how your checkout panes are getting defined since you're using "myodule" here and "mymodule" everywhere else. Is the module actually named myodule?

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
You crack me up buddy! Only

You crack me up buddy! Smiling Only for the forum i renamed my module and there comes the typo from: Listen and believe me that the function is being called else you would get something like

Fatal error: Call to undefined function uc_cart_checkout_next_button() in /var/kunden/webs/p14test/projekt14.eu/uDrupal/modules/uc_coupon/uc_coupon.module on line 473

:: Here the unupdated to 7e version of this contribution is seeking an ubercart function, that seems to no longer exist? Right.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: You crack me up buddy! Only

Well, I understand your point... and I'll just say that, as far as I know, there is no problem with the checkout pane or order system that is preventing it from working for you - especially if you're basing your work off a working module I wrote. Sticking out tongue

So, instead of just trying to guess what's wrong, I won't give this any more attention until the actual code is posted up here to examine. (And please use PHP tags <?php ?> so people can read it.)

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
<?phpfunction
<?php
function myodule_checkout_pane()

{

$panes[] = array(
'id' => 'any_id',
'callback' => 'mymodule_greetingz',
'title' => t('...'),
'desc' => t("..."),
'weight' => 1,
// 'process' => TRUE,
// 'collapsible' => FALSE,
);
return
$panes;

}

?>
<?php
function mymodule_greetingz($op, &$order, $data) {

$display = FALSE;

foreach(

$order->products as $key=> $orderitem) {

if ( (

$orderitem->model == "gift1") || ($orderitem->model == "gift2") ) {

$display = TRUE;

}

switch (

$op) {

case

'view':

if (

$display) { return $contents for pane} .........
?>

what does this now have to do with the undefined function above? j/k Cool and if know that it is supposed to work as it is mainly based on uc_lead, but it does not Smiling

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Re: <?phpfunction

@Ryan??

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: <?phpfunction

Sorry man... I have no clue what error you're experiencing or if it's even related to your code. Have you disabled the coupon module? Is there a reason you can't even just attach the module to a forum post?

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
me neither ok, what about

me neither Laughing out loud ok, what about this lost coupon module function seeking a former known function in ubercart core as ....next_button() ??? I mean you must have moved this one, right Smiling 7e error

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: me neither ok, what about

No, that function is gone and won't be back. Smiling Not moved, just removed. And uc_coupon hasn't been updated for the latest versions of Ubercart.

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Really! Ok, then at least

Really! Eye-wink Ok, then at least tell me where that functionality has gone? what was button next for and where was it now integrated into so that i can update the coupon module myself ..

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Really! Ok, then at least

Best bet is to read the thread I posted on the new checkout pane system. That function is gone b/c it's been folded into the cart module itself. You can just remove the line altogether.

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Re: Re: Really! Ok, then at least

Cheers, that sounds cool. And this will stay allow for inserting multiple cash-ins of coupons for one order? THX!!! I will try it out tomorrow...

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Re: Re: Really! Ok, then at least

Yes, now i got no more chance to enter a coupon code during checkout ????

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Ok, i killed that one line

Ok,

i killed that one line in the $pane field's and another function I had renamed with 'new' as it was so found in the 7e code.. No success yet! I get no coupon pane at all now.

Since it is folded into the cart module, is there a way now to point to that if needed?

Many folks here love to have that coupon module up and running, and for some code expert I see no big deal in updating it swiftly for us all Puzzled (I buy the online beer!!)

oslinux's picture
Offline
Joined: 09/06/2007
Juice: 461
Re: Ok, i killed that one line

Can it be that when i do process print_r $arg1 that then the pane data is not yet added to to order object, but first when hook order is called on the next page?? Thought this to occur when coupon module checks for valid coupon?

Still, then how would i pass on greetz text from checkout pane to order hook without wanting it to be save din a db like in lead?