Page 1 of 2
Product Size Guide - Tabs
Posted: Thu Jul 21, 2022 7:57 am
by LeeFoster
Before I start working on this has anyone created a size guide tab for stores that sell things like t-shirts?
The site I'm currently working on sells items in different sizes (small, medium, large etc) I'd like to be able to create a table to show the size guide in a tab and then select which size guide to use for which product or to not use one at all.
Re: Product Size Guide - Tabs
Posted: Mon Aug 08, 2022 9:09 am
by LeeFoster
Right guys,
I am back from my holidays and I am starting to look at creating this.
Here is what I am looking to achieve.
In admin I will be creating a section where size guides can be created, this will be done by first creating a size guide then by adding the various sizes to the guide. You will then be able to assign a size guide to a product.
This will allow the adding of size guides based on the product, I use T-shirts in my previous example so will do so again. Take the difference between mens and womens.
Mens will show Small, Medium, Large etc with the measurement being chest in cm/inch, Womens however will show 8, 10, 12 etc with the measurement being bust in cm/inch. Along with those for children.
On the front end I aim to have this displayed in a product tab.
So I will need to create
- Relevant database tables
- Admin section pages
- Hook to add to Product Admin
- PI tab module
There may be more to this but I will keep you updated. If anyone wishes to contribute feel free to drop me a message.
Re: Product Size Guide - Tabs
Posted: Mon Aug 08, 2022 9:40 am
by radhavallabh
LeeFoster wrote: ↑Mon Aug 08, 2022 9:09 am
Right guys,
I am back from my holidays and I am starting to look at creating this.
Here is what I am looking to achieve.
In admin I will be creating a section where size guides can be created, this will be done by first creating a size guide then by adding the various sizes to the guide. You will then be able to assign a size guide to a product.
This will allow the adding of size guides based on the product, I use T-shirts in my previous example so will do so again. Take the difference between mens and womens.
Mens will show Small, Medium, Large etc with the measurement being chest in cm/inch, Womens however will show 8, 10, 12 etc with the measurement being bust in cm/inch. Along with those for children.
On the front end I aim to have this displayed in a product tab.
So I will need to create
- Relevant database tables
- Admin section pages
- Hook to add to Product Admin
- PI tab module
There may be more to this but I will keep you updated. If anyone wishes to contribute feel free to drop me a message.
This will be surely a great addition to the product features;
We can also add a picture scale beside the table to understand what each pointer mentioned refers too...
Regds./
radhavallabh
Re: Product Size Guide - Tabs
Posted: Mon Aug 08, 2022 4:41 pm
by burt
Potential things to try (on a new test shop), as these may more or less do the job you need, maybe (they ring a bell with me based on my reading of your posts);
S02E06 - Product Terms
along with S03E04 - Terms Tab
Or maybe this;
S04E10 - Product Specs
along with S06E06 - Specs extension
Re: Product Size Guide - Tabs
Posted: Mon Aug 08, 2022 4:54 pm
by LeeFoster
burt wrote: ↑Mon Aug 08, 2022 4:41 pm
Potential things to try (on a new test shop), as these may more or less do the job you need, maybe (they ring a bell with me based on my reading of your posts);
S02E06 - Product Terms
along with S03E04 - Terms Tab
Or maybe this;
S04E10 - Product Specs
along with S06E06 - Specs extension
Product Specs I am already using. Product Terms I don't think will work.
I am using Product Specs as the basis for this though.
Re: Product Size Guide - Tabs
Posted: Thu Aug 11, 2022 11:36 am
by LeeFoster
Right guys,
Some progress is being made and I'm almost there, but I need help with a few issues.
First up, when adding the value options I'm dynamically creating x number of fields to add them eg. 3 fields for small, medium, large. However when I click save these values are not passed to the sql query and therefore not to the database.
JS code
Code: Select all
$(document).ready(function() {
$('select').on('change', function() {
var selectValue = $(this).val();
$.ajax({
type: "POST",
url: "ext/scripts/get_sizes.php",
data: {
selected: selectValue
},
success: function (data) {
$('#values').html(data);
// Stuff
},
error: function (data) {
// Stuff
}
});
});
});
Query and result
Code: Select all
$selectedValue = $_POST['selected'];
$sqlQuery = $db->query("SELECT * FROM products_sizes where products_sizes_id = '$selectedValue'");
$string = $sqlQuery->fetch_assoc();
$str_arr = preg_split ("/\,/", $string['products_sizes_sizes']);
foreach ($str_arr as $id) {
echo '<input class="form-control input-sm" name="val[]" value="'. $id .'"> ';
}
Submit code
Code: Select all
$member_id = Text::input($_POST['member_id']);
$member_sort = Text::input($_POST['member_sort']);
$group_id = Text::input($_POST['group_id']);
$a = implode(",", $_POST['val']);
foreach ($languages as $l) {
$member_name = Text::prepare($_POST['member_name'][$l['id']]);
$db->query("INSERT INTO products_sizes_values (products_sizes_values_id, language_id, products_sizes_id, products_sizes_values_name, products_sizes_values, psv_sort_order) VALUES (" . (int)$member_id . ", " . (int)$l['id'] . ", " . (int)$group_id . ", '" . $db->escape($member_name) . "', '" . $a . "', " . (int)$member_sort . ")");
}
return $Admin->link('products_sizes.php', $page_info);
Any help to get this over the line would be much appreciated.
Re: Product Size Guide - Tabs
Posted: Thu Aug 11, 2022 12:00 pm
by ecartz
In the Javascript that posts, you are calling it selected. In the PHP code that submits, you are calling it val. Those two need to match.
Code: Select all
$a = implode(',', $_POST['selected']);
Re: Product Size Guide - Tabs
Posted: Thu Aug 11, 2022 12:07 pm
by LeeFoster
ecartz wrote: ↑Thu Aug 11, 2022 12:00 pm
In the Javascript that posts, you are calling it selected. In the PHP code that submits, you are calling it val. Those two need to match.
Code: Select all
$a = implode(',', $_POST['selected']);
The javascript doesn't post the form, it grabs the number of values then creates an input for each one. They're 2 separate functions.
Re: Product Size Guide - Tabs
Posted: Fri Aug 12, 2022 12:34 pm
by LeeFoster
I'm being told by other sources that it is because the dynamic inputs are outside the form. But all the inputs appear to be outside the form, it is using code mainly from products_tags.php
Re: Product Size Guide - Tabs
Posted: Fri Aug 12, 2022 1:51 pm
by ecartz
LeeFoster wrote: ↑Fri Aug 12, 2022 12:34 pm
I'm being told by other sources that it is because the dynamic inputs are outside the form. But all the inputs appear to be outside the form, it is using code mainly from products_tags.php
I looked at products_tags.php and things there are inside the forms (there's more than one). So it's not clear to me what you mean by "inputs appear to be outside the form".
You don't include enough context for me to say that about your page. In general, the input should appear after a <form or echo Form( and before the </form>.