Post by teknojunkey » Wed Aug 26, 2009 8:37 am

Hi

I want to create more module positions for my layout and cant seem to find where to register these
I realy need more than left and right!

<div id="toprightbasket">
<?php foreach ($modules as $module) { ?>
<?php if ($module['position'] == 'topright, footer, main etc, etc, etc,') { ?>
<?php echo ${$module['code']}; ?>
<?php } ?>
<?php } ?>
</div>

Is there a tutorial or advice on this already, i couldnt find any.

thanks

New member

Posts

Joined
Fri Oct 10, 2008 8:25 am


Post by teknojunkey » Wed Aug 26, 2009 11:03 pm

MVCL stupid!
add the following.

admin\controller\module\cart.php
$this->data['text_top'] = $this->language->get('text_top');

dmin\language\english\modulecart.php
$_['text_top'] = 'top';

admin\view\template\module\cart.tpl
<?php if ($cart_position == 'top') { ?>
<option value="top" selected="selected"><?php echo $text_top; ?></option>
<?php } else { ?>
<option value="top"><?php echo $text_top; ?></option>
<?php } ?>


add to the template
catalog\view\theme\default\template\common\layout.tpl
<div id="topleftmenu">
<?php foreach ($modules as $module) { ?>
<?php if ($module['position'] == 'top') { ?>
<?php echo ${$module['code']}; ?>
<?php } ?>
<?php } ?>
</div>

i think that was all o changed ...

New member

Posts

Joined
Fri Oct 10, 2008 8:25 am


Post by readyman » Fri Aug 28, 2009 5:58 am

Good stuff.
Yeah, basically copy the code for the left/right modules...

http://www.alreadymade.com
Follow me on twitter.com/alreadymade


User avatar
Global Moderator

Posts

Joined
Wed May 20, 2009 5:16 am
Location - Sydney

Post by francoisv » Fri Feb 11, 2011 5:33 pm

I must be doing something wrong.
I have ver 1.4.9.3. and I dont have this file :
catalog\view\theme\default\template\common\layout.tpl

I tried creating it and added the content but it doesn't show up in the options.
Nothing seems to happen.

I still only have left and right.

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by SXGuy » Fri Feb 11, 2011 9:50 pm

Personally, the code is somewhat correct but i think you should be creating new files for the module position, not adding them to the cart files.

catalog/view/theme/default/template/common/home.tpl
<?php echo $header; ?><?php echo $column_left; ?><?php echo $topleft; ?><?php echo $column_right; ?>

catalog/view/theme/default/template/common/topleft.tpl

Code: Select all

<div id="topleft">
  <?php foreach ($modules as $module) { ?>
  <?php echo ${$module['code']}; ?>
  <?php } ?>
</div>
See what i mean?

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by Qphoria » Fri Feb 11, 2011 10:23 pm

This example is from 2009 back when we had a layout.tpl
This is 2011... things have changed

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by francoisv » Sat Feb 12, 2011 3:57 pm

Ok. How would you do it now then?
Will the new 1.5 have the option of more positions?
I love Opencart. Think it is the best thing since toasted bread. But it would be nice to have more options in placing modules. The client I have now wants dropdown menus!!
I have a template that puts the catagories in the dropdown menu position but what it we want to put other pages in the dropdown, like this template : http://themes.opencarttemplate.net/inde ... e=default6

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by SXGuy » Sat Feb 12, 2011 5:57 pm

there is another thread regarding drop down header menu's.

Just copy all the code to do with column_left and create seperate files for each, relabeling everthing to for example topleft.

Then place <?php echo $topleft; ?> wherever you want the module position to be in each of the pages. i.e home, product, category etc.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by francoisv » Sat Feb 12, 2011 7:09 pm

You wouldn't happen to know the url to the thread please?

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by SXGuy » Sun Feb 13, 2011 1:29 am

Sure, i can do better than that, i can give you the direct link to the page that explains how

http://craigmurray.me.uk/opencart-mods/ ... -opencart/

and this may help also

http://www.alistapart.com/articles/dropdowns

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by francoisv » Mon Feb 14, 2011 2:49 am

Thx. I will try it on a test site.
Can you look at something else please.
I made a post for this, but don't get any replies.

On this website : http://www.oscarmusic.co.za/index.php?r ... duct_id=54

The individual mp3's at the bottom can be added to the cart. Ho do I get it to just add to cart without moving to the cart page, like the "Add to Cart" button at the top?

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by SXGuy » Mon Feb 14, 2011 6:07 am

im guessing you need to add the AJAX add to cart function for those buttons, it should add them without moving to the cart page.

If you disable ajax add to cart in the module extension you will see it has the same affect.

Code: Select all

<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span><?php echo $button_add_to_cart; ?></span></a>
Taken from the product.tpl file, notice the id="add_to_cart" and the function $('#product').submit();

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by francoisv » Mon Feb 14, 2011 2:02 pm

Ok, if this is the code for the button, where would I add the function? I am still learning - thx for the advise!

<td>
<img alt="" src="http://www.oscarmusic.co.za/image/data/buy.jpg" style="width: 33px; height: 17px;" /></td>

I looked at the source of the page and it gives this for the "Add to Cart" button on top.

<form action="http://www.oscarmusic.co.za/index.php?r ... ckout/cart" method="post" enctype="multipart/form-data" id="product">
<div class="content">

Qty: <input type="text" name="quantity" size="3" value="1" />
<a onclick="$('#product').submit();" id="add_to_cart" class="button"><span>Add to Cart</span></a>
</div>
<div>
<input type="hidden" name="product_id" value="54" />
<input type="hidden" name="redirect" value="http://www.oscarmusic.co.za/index.php?r ... duct_id=54" />
</div>
</form>

I tried adding this to the button at the bottom and changing the product_is to the song instead of the album.
It then shows the "add to cart" button but when you click on it, it still adds the album and not the single mp3. And it takes you to the cart page. Must be doing something wrong ??? . I think it gets the product_id from the page in which it is displayed - thus the album_id - hopes this makes sense.

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by SXGuy » Mon Feb 14, 2011 5:31 pm

where is the data its passing to add the single track? i couldnt see it from your code you posted for the button image

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by francoisv » Mon Feb 14, 2011 7:44 pm

This is the code:

<td>
<a href="http://www.oscarmusic.co.za/index.php?r ... d=55"><img alt="" src="http://www.oscarmusic.co.za/image/data/buy.jpg" style="width: 33px; height: 17px;" /></a></td>

Basically I added the single track as a product so that it has its own product_id.

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by francoisv » Mon Feb 14, 2011 11:00 pm

I changed the "continue shopping" button to take me back to the previous page. This is a work around, but still not ideal.

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by SXGuy » Tue Feb 15, 2011 2:38 am

the problem is, if you use a form and onclick to submit the single track products to the cart it wont work, because it will send the data based on the original form which is the main product add to cart button.

Plus the way in which the ajax function is set up, it only allows one product_id to be sent to the cart, i.e the product page's product_id.

Seems to me you need a new ajax function which includes the product_id value based on the button that was clicked.

Active Member

Posts

Joined
Sun Nov 08, 2009 2:07 am

Post by francoisv » Tue Feb 15, 2011 3:09 am

Thx for your input. I almost got it working today but the 2 buttons were swopped somehow. I will post here if I ever get it working. Any extra help will be great. Thx

New member

Posts

Joined
Thu Nov 04, 2010 5:08 pm

Post by Dreamvention » Sun Jun 17, 2012 7:14 pm

You can add extra positions simply using this extansion
http://www.opencart.com/index.php?route ... on_id=6916

Many OpenCart users struggle to find quality extensions. We know how frustrating the need to fix the shop is just because of one poorly coded extension. We created quality OpenCart Extensions, tested by real developers and provide professional support.

AJAX QUICK CHECKOUT - #1 one-page checkout solution
VISUAL DESIGNER - Page builder for Opencart
View more extensions here

Tested by Shopunity.net


User avatar
Administrator

Posts

Joined
Sun Jun 17, 2012 7:04 pm
Location - Europe
Who is online

Users browsing this forum: No registered users and 2 guests