Hello everybody!
I use e-commerce 3.4 stable version drupal 5.7.
Try to create recurring products from CCK node type, but can't though it is possible to create node product type for example generic product and make it recurring product, choosing shedule..
But for me it's necessary to have several types of recurring products with different fields.
So the question is how to make recurring product work with nodes of type different from "product"?
I found in the module such strings:
/**
* Implementation of hook_form_alter().
*/
function ec_recurring_form_alter($form_id, &$form) {
if (product_form_is_product($form_id, $form)) {
$preset = is_array($form['product']['recurring']['sid']) ? $form['product']['recurring']['sid'] : array();
$allow_renewals = isset($preset['#allow_renewals']) ? $preset['#allow_renewals'] : TRUE;
$form['product']['recurring'] = array(
'#type' => 'fieldset',
'#title' => t('Recurring products'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#weight' => -15,
);
$slist = array('' => '--');
$slist+= ec_recurring_get_list($allow_renewals);
$form['product']['recurring']['sid'] = array(
'#type' => 'select',
'#title' => t('Renewal schedule'),
'#default_value' => $form['#node']->schedule['sid'],
'#description' => t('Select the renewal schedule to be used for this product. !link. NOTE: save your changes to this product first.', array('!link' => l(t('Add another schedule'), 'admin/ecsettings/schedule/add'))),
'#options' => $slist,
'#weight' => -1
);
$fields = array('#title', '#description');
foreach ($fields as $key) {
if (isset($preset[$key])) {
$form['product']['recurring']['sid'][$key] = $preset[$key];
}
}
}
}
and looked at function product_form_is_product() in module product? here it is:
/**
* Check a form to see if it is a node that has been turned into a product.
*
* @param $form_id
* The Id of the form that is being past.
*
* @param $form
* The form array which needs to be checked.
*
* @param #ptype
* If the form is dependent on a type of product, then this can be past to
* add an additional check.
*/
function product_form_is_product($form_id, $form, $ptype = NULL) {
if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id && $form['#node']->ptype) {
return ($ptype ? ($node['#node']->ptype == $ptype ? TRUE : FALSE) : TRUE);
}
return FALSE;
}
And for my custom CCK node it returns true when i make it to be product, but fields for choosing shedule doesn't appeare.
What steps should i do to to make it work?
Thanks!
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | ec_recurring_any_product_node_200811191357.patch | 743 bytes | sammys |
Comments
Comment #1
kshahan commentedI need to also get a solution to solve this issue. I would be happy to pay a programmer to look into this, please contact me on Drupal or by my regular email: kshahan@austincircle.com
1.Create new node type and select non-shippable product.
2.Select Submit to store.
3.Recurring schedule option should show up, (along with node access product that does)
4.New node should then show up under E-Commerce/Recurring products area.
I appreciate the assistance in resolving this issue. I'll also be getting familiar with the code and posting any possilble fixes that I can come up with. Thanks!
ps. It could be in the code (#2) where you submit to store and it converts to product.
pps. below is bit of code from node access product that does show up. Trying to figure out how it does, where recurring doesn't
Comment #2
sammys commentedFix has been committed
Comment #3
kshahan commentedNew issue...fix adds menu to new nodes. However, recurring product and node access selections won't save. Therefore, new node products wont show up in recurring or node access menus.
Under some pressure to get this resolved for website I'm developing., or please indicate what has to be done to get this accomplished.
Thanks!
Kerry
Comment #4
sammys commentedHi Kerry,
I've had a look into the recurring product problem. It appears the code assumes the node is of type 'product'. You'll find a patch attached.
Which module provides the node access stuff you're talking about?
Cheers,
--
Sammy Spets
Synerger Pty Ltd
http://synerger.com
Comment #5
kshahan commentedSammy, appreciate you staying on this. That patch has seemed to do the trick. I'll have to test further but products are now saving recurring feature selection. I'm using the node access product at link below. It seems that that will need some revision.
http://drupal.org/project/ec_nodeaccess (this link. standard ecommerce node access product.)
Another issue...and maybe it should be a new thread..but the recurring module. Is there anyway to set it to allow access for 24 hours only. It seems that the chron closes the day out at a specific time. I'm trying to sell node access for 24 hour period from the time purchased. However, it seems that the node access cuts off at the same time each night. Let me know if you have experience in this.
Thanks alot.
Kerry
Comment #6
sammys commentedKerry,
Apologies for the delay in replying. Hope it hasn't affected your development too much.
I'll take a look at ec_nodeaccess for you tomorrow along with committing the above patch to the tree. Hoping ec_nodeaccess will be straight forward to modify. Will let you know what I find out.
Comment #7
sammys commentedHi Kerry,
Here are my findings. The problem with ec_nodeaccess was reproducible and caused by the same initial design restriction. I've posted a patch to it as #342441 in the ec_nodeaccess issue queue. Please review this patch for non-product nodes and product nodes. We need to be sure it's working for both. Report any findings to #342441.
#342439: I've also patched in PostgreSQL support into the ec_nodeaccess installation file. I'd really appreciate if you reviewed that it doesn't break installation of the module on MySQL so we can get it committed.
Now that's done i'll take a quick look at the expiry processing as I can't remember what I wrote. :) Will post back in this issue.
Comment #8
sammys commentedAdjusted the issue title to clearly reflect the full reach of the symptom. I've also posted another issue (#342489) for the other module affected by the same problem (ec_roles). I'd appreciate some testing of ec_roles. Hope you have the time. It'll help get the code into the repository faster.
Renamed this issue to more clearly refer to the problem. Upped to apply to 3.5.
I've created a feature request to allow ec_recurring to process expirations every time cron runs. Please test it and report back to that issue.
The fix for this issue has been committed to 3.x-dev and will be rolled out in the next dev snapshot and 3.6 thereafter.
Comment #10
kshahan commentedSammy,
I've been out of town, but now I'm back and working over the weekend to further development on my site. I will review your latest patches and test them as requested..sorry about any delays in getting to this.
Keep me updated on any further progress.
Kerry