Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

php html delete

Posted on 2014-02-13
5
Medium Priority
?
216 Views
Last Modified: 2014-03-19
Hi ,

I use the below code, so user choose the select item type in drop down and the image will display based on the selection.

I dont want the "select item type" , need only the images.

Please help .

            <div id="select_phone_type" class="t_shirt tab_content">
                <div class="wrap_product_type">
                    <h3 class="product-type-title numbers first"><?php echo $this->__("Select Item Type") ?></h3>
            		<select id="t-shirt-type">
                        <?php 
                            $group_items = Mage::getModel( 'pdp/pdpgroup' )->getPdpGroup();
                            foreach ($group_items as $group_item ){ ?>
                                <option value='<?php echo $group_item->getId() ?>' <?php if($dt_ts[0]==$group_item->getId()) echo 'selected="selected"'; ?>><?php echo $group_item->getTitle() ?></option>
                            <?php }
                        ?>
                    </select>
                </div>
        		<div class="color_wrap no-display">
                    <h3 class="color-option"><?php echo $this->__("Select Item") ?></h3>
            		<div color="list" id="list_color">
            			<ul>
            			<?php $img_all = ''; $fi=0; foreach ($designs as $design) {
            			     if($dt_ts[4]==''){
            			         if($fi++==0){
                			         //$f_img_act = 'class="active"';
                			     }else{
                			         $f_img_act = '';
                                 }
            			     }else{
            			         if($dt_ts[4]==$design->getId()){
            			             $f_img_act = 'class="active"';
            			         }else{
                			         $f_img_act = '';
            			         }
            			     }
            				$option = unserialize($design->getOptions());
            				$frontInlay = $helper->getInlayInfoByFilename($design->getFilename());
            				$backInlay = $helper->getInlayInfoByFilename($design->getFilenameBack());
            				$leftInlay = $helper->getInlayInfoByFilename($design->getFilenameLeft());
            				$rightInlay = $helper->getInlayInfoByFilename($design->getFilenameRight());
                                                                             
                            $img_all .= '<img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'pdp/images/'.$design->getFilenameBack().'" /><img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'pdp/images/'.$design->getFilename().'" />';
            				echo '<li '.$f_img_act.' did="'.$design->getId().'" inlay="'.$frontInlay . '-' . $backInlay . '-' . $leftInlay . '-' . $rightInlay . '" relf="'. $design->getFilename().'" relb="' . $design->getFilenameBack() .'" relr="' . $design->getFilenameRight() .'" rell="' . $design->getFilenameLeft() .'" tt="'. $design->getPdpgroup() .'" price="'.$design->getPrice().'" ><img src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'pdp/images/'.$design->getFilename().'" /></li>';
            			} ?>
            			</ul>
            		</div>

Open in new window

magento-custom-module.gif
0
Comment
Question by:magento
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39858122
You can't change a dropdown to display images, you have to rewrite the page code to display images with appropriate links.
0
 
LVL 5

Author Comment

by:magento
ID: 39858194
Hi Dave,

The idea is to remove the dropdown first.

So after that the ...

products are available in $group_item->getId() then use the $design->getId() and show only the images instead of product .

The screenshot attached is what i looking for, but not sure how to make that part work.

Thanks
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39858284
You basically take the link and image that you have and duplicate it with the other options from the dropdown.  I'm not sure what your code is going to look like because you have a lot of things there that are not familiar to me.
0
 
LVL 59

Accepted Solution

by:
Julian Hansen earned 2000 total points
ID: 39858500
Is the code you posted already generating the list with images?

If so - can you not simply hide the <select> and put some javascript in on the image click to trigger a select change. That way you keep the integration between Magento engine and the select.

 Here is a very simple example.
<!doctype html>
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
$(function() {
  $('#test').change(function() {
    console.log('Changed to ' + $(this).val());
  });
  $('li img').click(function() {
    $('#test').val($(this).data('id')).trigger('change');
  });
});

</script>
<style type="text/css">
</style>
</head>
<body>
  <select id="test">
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
    <option value="4">Four</option>
  </select>
  <ul>
    <li><img src="images/00100_thm.jpg" data-id="1"/></li>
    <li><img src="images/00105_thm.jpg" data-id="2" /></li>
    <li><img src="images/00102_thm.jpg" data-id="3" /></li>
    <li><img src="images/00101_thm.jpg" data-id="4" /></li>
  </ul>
</body>
</html>

Open in new window

0
 
LVL 5

Author Comment

by:magento
ID: 39858720
Hi Julian,

Thanks for your email.

originally i have a dropdown with 3 values, when i click 1st value, it displays 1 st values image
when i click 2nd value in fropdown it shows 2nd values image and so on.

Since the customers may get confused because both of them are same. Now instead of that dropdown i want to display only product  images of 3 values .

I have hidden the select html

                        <select id="t-shirt-type" style="visibility:hidden;">

And now 50% of my goal is done.

But i cant able to make the javascript you have provided in my code.

Can you please check my code and advice?

Thanks
magento-custom-module.gif
t-shirt.html
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question