Closed (fixed)
Project:
Ubercart
Version:
7.x-3.x-dev
Component:
Products
Priority:
Normal
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
23 May 2011 at 02:52 UTC
Updated:
4 Jan 2014 at 00:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tr commentedI have been working on the Ubercart tokens and I already found and fixed this problem locally. I'll be committing my changes to 7.x-3.x-dev in the next few days. If you're not using tokens you can just ignore those PHP notices. If you want to use product tokens you'll have to wait for the fix.
Comment #2
jadamsfx commentedThanks but one more question and I'm not sure if you can answer this but do you think that your token fix would also fix the issue that I'm having with the custom price module. I'm trying to use the cost token to calculate price as follows.
$item->price = $item->price;
$item->price = [cost] * 1.1;
But i get the follwing error.
Parse error: syntax error, unexpected '[' in /home/jadamsfx/public_html/nueera.com/sites/all/modules/uc_custom_price/uc_custom_price.module(87) : eval()'d code on line 1
Comment #3
tr commentedRe: #2. I believe I answered that in the issue queue for uc_custom_price.
Here is my patch to the Ubercart tokens system. Please try it and let me know if you still see errors. Note that with this patch, all product tokens start with product: instead of node:, so instead of using the [node:cost] token for the product cost you will need to use [product:cost].
Comment #4
tr commentedActually, use this patch. I accidentally left a couple of debugging statements in the previous one and forgot to rebase it against 7.x-3.x head.
Comment #5
tr commentedComment #6
longwaveThis has been added to all token hooks, but $language_code never appears to be used, and uc_file_token_info() does not use $sanitize either.
Comment #7
jadamsfx commentedForgive me I'm rather new to drupal and patching. I placed this patch in my ubercart module folder and tried to run it but I get the following error "can't find file to patch at input line 5." When i opened up the patch file i saw you had an a and a b folder. Do I need to create those folders and then place the files in there?
Comment #8
longwaveThese are git-style patches, you need to use "patch -p1" to apply them, which will ignore the a/ and b/ prefixes.
Comment #9
jadamsfx commentedHere are the results that I get after patching.
Is that right?
Comment #10
longwaveLooks like you're testing the first patch instead of the second, and the patch needs to be applied against 7.x-3.x-dev, not beta2.
Comment #11
jadamsfx commentedGreat patch seems to be working not longer getting the errors. Thanks!
Comment #12
farnsworth commentedCan some one take the time to link or explain how to apply this patch not sure why but i am more lost then Rebecca black in a recording studio on this.
Comment #13
tr commented@farnsworth: First, make sure you have a recent version of Ubercart 7.x-3.x installed. Then download the patch http://drupal.org/files/issues/tokens-overhaul_0.patch into your ubercart directory. Use the command
patch -p1 < tokens-overhaul_0.patchto apply the patch.The patch should work as is and provide the changed mentioned in #3. But as @longwave noticed in #6, there are still some new features I intend to add that haven't been finished yet.
Comment #14
tdiepiv commentedHmm doesn't seem to be working for me:
host-103-84:~ john$ cd /Users/john/Sites/kissi/ubercart/
host-103-84:ubercart john$ patch -p1 < tokens-overhaul_0.patch
patching file uc_cart/uc_cart.module
patching file uc_file/uc_file.tokens.inc
patching file uc_order/uc_order.rules_defaults.inc
patching file uc_order/uc_order.tokens.inc
patching file uc_product/uc_product.tokens.inc
Reversed (or previously applied) patch detected! Assume -R? [n] n
Apply anyway? [n]
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file uc_product/uc_product.tokens.inc.rej
patching file uc_roles/uc_roles.tokens.inc
patching file uc_stock/uc_stock.tokens.inc
patching file uc_store/uc_store.tokens.inc
errors still on site:
Notice: Undefined variable: object in uc_product_tokens() (line 96 of /home/johni/kissique.com/sites/all/modules/ubercart/uc_product/uc_product.tokens.inc).
Notice: Trying to get property of non-object in uc_product_tokens() (line 96 of /home/johni/kissique.com/sites/all/modules/ubercart/uc_product/uc_product.tokens.inc).
Comment #15
tdiepiv commentedAlso getting errors when I save configurations for this specific module, tweetbutton:
Notice: Undefined index: name in _token_token_tree_format_row() (line 107 of /home/johni/kissi.com/sites/all/modules/token/token.pages.inc).
Unsure where the error is
Comment #16
tr commentedCommitted attached patch.
Comment #17
tr commentedTagging to remind myself that I intend to write SimpleTest cases for Ubercart's token support.