how to position options?
16 posts
• Page 1 of 1
how to position options?
I have a online swimwear shop and some products have multiple options (4+) for the top and the bottom of a specific bikini.
I would like to be able to position them next to each other, instead of under each other or even group them )for instance for the top and bottom). I´ve looked and searched, and have found countless ways to change the position of the modules, but it seems theres no way to reposition the options if you have multiple.
Can anybody help me out?
I would like to be able to position them next to each other, instead of under each other or even group them )for instance for the top and bottom). I´ve looked and searched, and have found countless ways to change the position of the modules, but it seems theres no way to reposition the options if you have multiple.
Can anybody help me out?
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
you will need to style your css with float. A little complicating.
-

MarketInSG - Posts: 2596
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: how to position options?
Complicating how?
I have quite a lot experience changing/modding code (php/CSS), just no idea how to write it from scratch
I have quite a lot experience changing/modding code (php/CSS), just no idea how to write it from scratch
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
you will need to assign them style="float:left". That will make them be able to float beside each other.
-

MarketInSG - Posts: 2596
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: how to position options?
Ok, I understand, but how do I select which modules are left and which will be right?
Is there a way to do this with the code? If, for example, the option ID is below a certain number then sort it to the left if bigger then a number then it go's right.
I understand if statements and all, I can even modifhy them, but just can't write them
Is there a way to do this with the code? If, for example, the option ID is below a certain number then sort it to the left if bigger then a number then it go's right.
I understand if statements and all, I can even modifhy them, but just can't write them

- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
- Code: Select all
<?php if ($option['name'] == 'something') { ?>
<div style="float:right">contents of options</div><?php } else { ?>
<div style="float:left">contents of options to float on right </div> <?php } ?>
you will have to try to figure it out according to your option names (i'm assuming they have different names so there will be sorted by their names).
-

MarketInSG - Posts: 2596
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: how to position options?
Thanks! I will give that a try tonight!
let you know how it works out!
let you know how it works out!
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
ok, got it working a bit, but not even close to my liking.
Also I'm having some issue's with the if statements. The options belonging to my products are all dropdown lists. And if i use the If statement as stated above, i'm getting a blank screen and and an error stating there is a unexpected } on line 385. Which is at the end of the copied/inserted code. I've added the code from product.tpl in a text file, it was a bit much to post in the thread.
But isn't there a more efficient way to use the error code? Using a variable which replaces the first part of the div container?
Something like;
Again, no idea what I'm talking about, maybe it's just rubbish, and I have no idea how to make such a string work correctly. But perhaps it could work
Also I'm having some issue's with the if statements. The options belonging to my products are all dropdown lists. And if i use the If statement as stated above, i'm getting a blank screen and and an error stating there is a unexpected } on line 385. Which is at the end of the copied/inserted code. I've added the code from product.tpl in a text file, it was a bit much to post in the thread.
But isn't there a more efficient way to use the error code? Using a variable which replaces the first part of the div container?
Something like;
- Code: Select all
$div_container_1 = "<div style="float:right">";
$div_container_2 = "<div style="float:left">";
<?php if ($option['name'] == 'something') { ?>
$div_container_1
<?php } else { ?>
$div_container2
Again, no idea what I'm talking about, maybe it's just rubbish, and I have no idea how to make such a string work correctly. But perhaps it could work

- Attachments
-
options-aligning.txt- (16.3 KiB) Downloaded 35 times
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
you get an error because you didn't close your brackets. and you need to echo or print the var, not just place it there. it won't do anything if you just place it there. read php.net for more help
-

MarketInSG - Posts: 2596
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: how to position options?
I'm sorry, it's not my intention at all to have you do all the work 
Will place an update tonight

Will place an update tonight
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
Got it working! 
Thanks for your support!
Two more question though;
If I want to declare more options to be sorted on the left/right, how do I add those additional option names to the code?
Withouth having to copy and adding the code for each option.
I've looked at php.net and read the manual, but couldn't find it.

Thanks for your support!
Two more question though;
If I want to declare more options to be sorted on the left/right, how do I add those additional option names to the code?
Withouth having to copy and adding the code for each option.
I've looked at php.net and read the manual, but couldn't find it.
- Code: Select all
<!-- EXTRA REGEL - OPTIE LAYOUT -->
<?php if ($option['name'] == 'size') { ?>
<!-- EXTRA REGEL - OPTIE LAYOUT -->
<div style="float:right" id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<!-- VOEG JE IMAGE HIER IN -->
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
</div>
<?php } else { ?>
<div style="float:left" id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<!-- VOEG JE IMAGE HIER IN -->
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
</div> <?php } ?>
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
base on your codes you gave below, add in a little more
this is what you have
this is what i change to
this is what you have
- Code: Select all
<?php if ($option['name'] == 'size') { ?>
this is what i change to
- Code: Select all
<?php if ($option['name'] == 'size' || $option['name'] == 'something' || $option['name'] == 'more things') { ?>
-

MarketInSG - Posts: 2596
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: how to position options?
It works, but it places the additional options right next to the first one, which obviously looks like crap, so I guess it's back to copying the code for each option seperately. Simply got no clue how to due it otherwise.
Edit: tried copying the code and inserting it below the first option but I get an error again (unexpected send command)
what am I missing?
Edit: tried copying the code and inserting it below the first option but I get an error again (unexpected send command)
what am I missing?
- Code: Select all
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'select' ) { ?>
<!-- EXTRA REGEL - OPTIE LAYOUT -->
<?php if ($option['name'] == 'size' ) { ?>
<!-- EXTRA REGEL - OPTIE LAYOUT -->
<div style="float:right; padding-right:50px" id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<!-- VOEG JE IMAGE HIER IN -->
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
</div>
<?php } else { ?>
<!-- EXTRA REGEL - OPTIE LAYOUT -->
<?php if ($option['name'] == 'model' ) { ?>
<!-- EXTRA REGEL - OPTIE LAYOUT -->
<div style="float:right; padding-right:50px" id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<!-- VOEG JE IMAGE HIER IN -->
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
</div>
<?php } else { ?>
<div style="float" id="option-<?php echo $option['product_option_id']; ?>" class="option">
<?php if ($option['required']) { ?>
<span class="required">*</span>
<?php } ?>
<b><?php echo $option['name']; ?>:</b><br />
<!-- VOEG JE IMAGE HIER IN -->
<select name="option[<?php echo $option['product_option_id']; ?>]">
<option value=""><?php echo $text_select; ?></option>
<?php foreach ($option['option_value'] as $option_value) { ?>
<option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</option>
<?php } ?>
</select>
</div> <br /> <?php } ?>
<?php } ?>
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
Re: how to position options?
missing a semi colon somewhere, enjoy finding >:D Anyway, you can do so with a div clear at end of each option, that will ensure they appear below each other 

-

MarketInSG - Posts: 2596
- Joined: Wed Nov 16, 2011 3:53 am
- Location: Singapore
Re: how to position options?
Got it working as I want, it's not live jet, but will be soon.
I'm selling bikini's with several options for both the bottoms as the top. For example bikini A has 3 different tops, a customer needs (is required) to select at least one of them. But with the current setup I can only set every option as required or non at all, is there a way to change this?
Or will this be a huge amount of work?
I'm selling bikini's with several options for both the bottoms as the top. For example bikini A has 3 different tops, a customer needs (is required) to select at least one of them. But with the current setup I can only set every option as required or non at all, is there a way to change this?
Or will this be a huge amount of work?
- burley
- Posts: 330
- Joined: Sun Oct 09, 2011 7:30 am
16 posts
• Page 1 of 1
Who is online
Users browsing this forum: alpa2009 and 28 guests














