- Posts: 55
- Thank you received: 2
Few sorting Questions
13 years 11 months ago #71576
by dlarge
Few sorting Questions was created by dlarge
Firstly I'd like to say thanks for all the help from my previous posts - great support everyone - i just wished i'd bought the Business version earlier as its saved so much work and time!
1) I am creating a book store and have created a couple of custom fields in the product table named "Author" and "ISBN" Now I have been asked if a number of catagories can sort the products by the Author's surname automatically. Now I know I can create a filter and then sort by Author which will sort it fine by their firstname(i entered firstname - surname in the custom field) - so was thinking I would need to split the author into two fields "Firstname" and "Surname" but I need to display the full author name on the product page. Im guessing I would need to mess around with the code so it will display it all as one name? Can anyone think of a better way of doing this?
2) Related to the question above I would like the sorting to happen automatically without the end user having to click on the filter options? Is this possible? I would prefer not to have the filter button showing.
3) Lastly (for now!) I have created two variants of most of the products, being "Paperback" and "Hardback". Im wondering if I have done something wrong as when I do a search for a product(book) it returns three results, one being the main one, and the two variants, but effectively there is only two products - should I be doing something different when entering the products?
Thanks in advance
1) I am creating a book store and have created a couple of custom fields in the product table named "Author" and "ISBN" Now I have been asked if a number of catagories can sort the products by the Author's surname automatically. Now I know I can create a filter and then sort by Author which will sort it fine by their firstname(i entered firstname - surname in the custom field) - so was thinking I would need to split the author into two fields "Firstname" and "Surname" but I need to display the full author name on the product page. Im guessing I would need to mess around with the code so it will display it all as one name? Can anyone think of a better way of doing this?
2) Related to the question above I would like the sorting to happen automatically without the end user having to click on the filter options? Is this possible? I would prefer not to have the filter button showing.
3) Lastly (for now!) I have created two variants of most of the products, being "Paperback" and "Hardback". Im wondering if I have done something wrong as when I do a search for a product(book) it returns three results, one being the main one, and the two variants, but effectively there is only two products - should I be doing something different when entering the products?
Thanks in advance
Please Log in or Create an account to join the conversation.
13 years 11 months ago #71631
by Xavier
Replied by Xavier on topic Re: Few sorting Questions
Hi,
1) I think that you have to create two custom fields, and then edit the view "product / show_block_custom_main" in HikaShop > Display > Views.
and replace the code:
By, for example:
2) You can hide the button filter in the options of the Filter Module in Joomla > Extensions > Module manager. To apply a filter automatically, in HikaShop > Display > Filters edit your filter and choose yes for the option "Submit on click".
1) I think that you have to create two custom fields, and then edit the view "product / show_block_custom_main" in HikaShop > Display > Views.
and replace the code:
Code:
?>
<tr class="hikashop_product_custom_<?php echo $oneExtraField->field_namekey;?>_line">
<td class="key">
<span id="hikashop_product_custom_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_name">
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
</span>
</td>
<td>
<span id="hikashop_product_custom_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_value">
<?php echo $this->fieldsClass->show($oneExtraField,$value); ?>
</span>
</td>
</tr>
<?php
Code:
if($oneExtraField->field_namekey == 'surname'){
?>
<tr class="hikashop_product_custom_<?php echo $oneExtraField->field_namekey;?>_line">
<td class="key">
<span id="hikashop_product_custom_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_name">
<?php echo "Name";?>
</span>
</td>
<td>
<span id="hikashop_product_custom_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_value">
<?php
echo $this->fieldsClass->show($oneExtraField,$value);
}elseif($oneExtraField->field_namekey == 'lastname'){
echo " ".$this->fieldsClass->show($oneExtraField,$value);
?>
</span>
</td>
</tr>
<?php
}else{
?>
<tr class="hikashop_product_custom_<?php echo $oneExtraField->field_namekey;?>_line">
<td class="key">
<span id="hikashop_product_custom_name_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_name">
<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
</span>
</td>
<td>
<span id="hikashop_product_custom_value_<?php echo $oneExtraField->field_id;?>" class="hikashop_product_custom_value">
<?php echo $this->fieldsClass->show($oneExtraField,$value); ?>
</span>
</td>
</tr>
<?php
}
2) You can hide the button filter in the options of the Filter Module in Joomla > Extensions > Module manager. To apply a filter automatically, in HikaShop > Display > Filters edit your filter and choose yes for the option "Submit on click".
The following user(s) said Thank You: dlarge
Please Log in or Create an account to join the conversation.
13 years 11 months ago #71823
by dlarge
Replied by dlarge on topic Re: Few sorting Questions
Hi Xavier,
Many Thanks for your reply and great support once again. I will give it a go, and see how i get on.
Dave
Many Thanks for your reply and great support once again. I will give it a go, and see how i get on.
Dave
Please Log in or Create an account to join the conversation.
Time to create page: 0.178 seconds