Post by paulrm6 » Thu Mar 01, 2012 7:26 am

Quickly before I do this...
My dofe and pnew are varchars, is this ok?
Paul

New member

Posts

Joined
Tue Feb 28, 2012 7:08 am

Post by SkipperTheEyechild » Thu Mar 01, 2012 12:35 pm

@ paul

It should be fine that they are varchars. I set mine up as Bool in my MySQL database, but defaulted them to 0.

Regardless, the conditional in the Template file is only using the == and not the === operator. So you should be fine.

User avatar
New member

Posts

Joined
Fri Feb 24, 2012 8:58 am
Location - Montana

Post by paulrm6 » Thu Mar 01, 2012 4:11 pm

Hi,
Uploaded these files... Got this error when trying to take a product OFF being dofe or pnew... however it did still remove it even if the error appeared...

Code: Select all

Notice: Undefined index: dofe in /home/theadv11/public_html/admin/model/catalog/product.php on line 132Warning: Cannot modify header information - headers already sent by (output started at /home/theadv11/public_html/admin/index.php:83) in /home/theadv11/public_html/vqmod/vqcache/vq2-system_engine_controller.php on line 28Warning: Cannot modify header information - headers already sent by (output started at /home/theadv11/public_html/admin/index.php:83) in /home/theadv11/public_html/vqmod/vqcache/vq2-system_engine_controller.php on line 29
And also this error when inserting a new product by the checkboxes...

Code: Select all

Notice: Undefined index: 1 in /home/theadv11/public_html/admin/view/template/catalog/product_form.tpl on line 37 />DOFE Award	 Notice: Undefined index: 1 in /home/theadv11/public_html/admin/view/template/catalog/product_form.tpl on line 38 />New Item!

New member

Posts

Joined
Tue Feb 28, 2012 7:08 am

Post by SkipperTheEyechild » Fri Mar 02, 2012 12:56 am

@ paul

Are you running any additional modules with OpenCart at this time? It could be that something else is causing a conflict somewhere in there. But by the error it really looks like the problem is in your Template file, and perhaps the checkbox elements aren't being named correctly? For that matter, did I name your variables correctly? dofe and pnew rather than Dofe, or DoFe, or DOFE or anything like that. You may want to double check your database column names and make sure that they exactly match the name of the checkbox element.

As for the undefined index: 1, that might just require you to remove the "== 1" part of the template file and just check to see if the variable is true.

Something else to look at is try re-configuring your database table structure so that rather than varchar they are bool. This shouldn't be the issue, but we may as well try everything.

Additionally, and this is my fault for forgetting to ask, but what version of OpenCart are you running. I'm currently using 1.5.1.3.

User avatar
New member

Posts

Joined
Fri Feb 24, 2012 8:58 am
Location - Montana

Post by paulrm6 » Fri Mar 02, 2012 1:24 am

I added this before the check boxes and it fixed the big error...

Code: Select all

<input type="hidden" name="product_description[<?php echo $language['language_id']; ?>][dofe]" value="">
		<input type="hidden" name="product_description[<?php echo $language['language_id']; ?>][pnew]" value="">
So it would have something to submit if the check box was not ticked, this seemed to do the trick...
I'm still getting the undefined 1 error when I create a new product even with removing ==1...
Also I have found another issue... on the catergories display page, when you switch between grid and list, it stacks up lots of (null)'s every time you switch where Dofe or New would be displayed... Thanks

New member

Posts

Joined
Tue Feb 28, 2012 7:08 am

Post by SkipperTheEyechild » Fri Mar 02, 2012 3:59 am

@ paul

Okay. I figured out what was causing the undefined 1 error.

When you are checking to see if the item == 1 you currently have this:

Code: Select all

<input type="checkbox" name="product_description[<?php echo $language['language_id']; ?>][pnew]" value="1" <?php if ($product_description[$language['language_id']]['pnew'] == 1) { echo 'checked="checked"'; } ?> />
you need to change them to this:

Code: Select all

<input type="checkbox" name="product_description[<?php echo $language['language_id']; ?>][pnew]" value="1" <?php if (isset($product_description[$language['language_id']]['pnew']) && $product_description[$language['language_id']]['pnew'] == 1) { echo 'checked="checked"'; } ?> />
All I did there was to add to the conditional statement so that way if you are creating a new item it looks to see if $product_description[language_id][dofe] exists. This gets rid of that annoying error when creating new products.

You may need to be a bit more specific about the grid view. If I place:

Code: Select all

<?php if($product['dofe']){ ?>
   stuff here
<?php } ?>
Somewhere in the product display, it just display the 'stuff here' whether I'm in grid or list view. If I switch back and forth it doesn't stack. Are you by chance telling it to show up via the Javascript function display(view) on the template page? If so, just put it straight in your html where it loops through each product in the foreach() loop.

Otherwise you may need to take a screen cap of these nulls stacking up.

User avatar
New member

Posts

Joined
Fri Feb 24, 2012 8:58 am
Location - Montana

Post by paulrm6 » Fri Mar 02, 2012 4:24 am

Ok, the admin bit is now working, but I don't quite understand the view page for products...
I'll upload my category.tpl file so you can see what I'm doing wrong... At the moment, it does not display anything on the pages...
Thanks, Paul

Attachments


New member

Posts

Joined
Tue Feb 28, 2012 7:08 am

Post by SkipperTheEyechild » Fri Mar 02, 2012 4:58 am

@ paul

Okay. I'm not sure, but it wasn't showing up for me at all in my file. I moved it to within the <div class="price"> and it shows up fine, and no stacking issues.

Occasionally when messing around with it I got some crazy results where it would show up everywhere, but then I realized it was just because a <div> tag didn't get closed out. Take a look at this file, and see if it works for you.

User avatar
New member

Posts

Joined
Fri Feb 24, 2012 8:58 am
Location - Montana

Post by paulrm6 » Fri Mar 02, 2012 6:28 am

Works Perfectly!
Thank you so much for all your work! - It's helped me alot!
thanks again, Paul

New member

Posts

Joined
Tue Feb 28, 2012 7:08 am

Post by appaji » Tue Aug 13, 2013 3:48 pm

Hi,

I need help to add an extra image uploader in the same Data tab in addition to the extra fields. Can you help me?
-Appaji

Newbie

Posts

Joined
Thu Jan 17, 2013 5:34 pm
Who is online

Users browsing this forum: No registered users and 120 guests