Jump to content

hungryfrank

Members
  • Content count

    427
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by hungryfrank


  1. @LeeFoster

     $.get("images/sample/"+text)
          .done(function() { 
            if( value > 0) { $("a.lb:first").html( "<img src=images/"+ {$prod_id} + "_" + selectedImage + ".jpg>");
          $('a.lb:first img').addClass( "img-fluid" );$('a.lb:first img').addClass( "img-fluid" );}
          }).fail(function() { 
          
    
        });

    this is the part that checks if image exist. change the image source and get image 

    first line looks for the image

    value>0 is so it docent change when it is switched to --select--

    this is the part in mine

      $.get("images/sample/"+text)
          .done(function() { 
            if( value > 0) $("a.lb:first").html(`<img src="${source}" style="width: 100%" class="img-fluid" />`);
          
          }).fail(function() { 
          //  if( value > 0) $("a.lb:first").html(`<img src="${source}" style="width: 350px" class="img-fluid" />`);
    
        });

     


  2. 5 hours ago, LeeFoster said:

    When put inside my existing hook this doesn't work for me. That said you did say you had it hard coded.

    dose it work for u?

    I have almost solved the last part. I will post it when t is cleaned out.

    I am going to use a header tag  instead of a hook.

    I will eventualy  add a button that will give the final image if the shop owner decides to implement a multi option images. maybe 

    if I figure out the exact  sort order of attributes and options,  have not looked at all

     

    can u post your header tag

     


  3. 4 hours ago, burt said:

    I completely forgot to give you the PROTO-code I used. 
    PROTO-code is code that is made to test a concept and should not be used in a production environment, but it might give you ideas...

    
    <script>
    $('select').change(function() {
      a = $(this).find('option:selected').attr('value');
      
      img = (a) ? "images/<?php echo $product_info['products_id']; ?>_" + a + ".jpg" : "images/<?php echo $product_info['products_image']; ?>";
      
      $('.pi-gallery img:first').attr('src', img); 
    });
    </script>

     

    thanks Burt.  

    I will play with this it seems that it answers a lot not my questions. 

    thinking a simpler way would be to just add an active  class to the image that is to be used.

    but this neccessitates to have the option-images to be in product_images. db while your way  allows for a ftp upload of the images so they won't be in the thumbs. I like it better

     


  4. I have this line but it doesn't work  100%. maybe 50%

    // $( '<div class="carousel-item text-center "><img src="images/store_logo.png" alt="" width="1680" height="1050" class="img-fluid" loading="lazy"></div>' ).insertBefore( "div.carousel-item:last" );
       


  5. 4 hours ago, LeeFoster said:

    How did you get around this?

    this is what I have so far  with a lot of help from stack

    <script>
    $(function() {
       var img_option = "<?php echo $_GET['products_id']; ?>";
       const inputs = $('[id^=input_]').filter(function () {
          return this.id.match(/input_\d+$/); //regex for the pattern "input_ followed by a number"
       });
       inputs.on('change', function() {
          let text = this.options[this.selectedIndex].text;
          let value = this.options[this.selectedIndex].value;
          let parenthesis = text.indexOf("(")-1;
          if( parenthesis > -1) text = text.substring(0,parenthesis);
          text=img_option + "_" +text;
          let source = `images/sample/${text}.jpg`;
          $.get("images/sample/"+text)
          .done(function() { 
            if( value > 0) $("a.lb:first").html(`<img src="${source}" style="width: 100%" class="img-fluid" />`);
            $(".carousel-item.active").html(`<img src="${source}" style="width: 100%" class="img-fluid" />`);
          // $( '<div class="carousel-item text-center active"><img src="images/Image-10-22-1398-AP-at-18.40.gif" alt="" width="1680" height="1050" class="img-fluid" loading="lazy"></div>' ).insertBefore( "div.carousel-item:first" );
          }).fail(function() { 
          //  if( value > 0) $("a.lb:first").html(`<img src="${source}" style="width: 350px" class="img-fluid" />`);
    
        });
          
       });
    }); 
    
    
    
    </script>

     


  6. 1 hour ago, burt said:

    Too difficult to handle in the current system of options/attributes. 
    On the to-do list is a remake of the options/attributes area from the bottom up, but I cannot say when or even if it will ever be done.

     

    If what you have made works for you as is; :thumbsup: and well done.

    When you swap out the image, what image shows in the modal gallery popup?  The original or the new?

     

    If you had 3 options each with 3 attributes, you would have to create 27 images, the way that you are thinking this system. 
    It's inflexible, though it would be easily doable, assuming shopowner had time to make and name images appropriately.

    please if u get to do it also implement option type 

    27 images only if I add a button to click to get the result. since there might be instances that one is not selected.

    I have resolved other issues, like not having an image, and working for all attributes.

    I wil post as soon as I cleanup. a little

    original. image I will figure it out

     

     

     

    to


  7. 23 hours ago, LeeFoster said:

    My current range of products only have one attribute, I'll address multiple attributes when it comes up unless @burt
    has an idea?

    I am going  to work on this and make an add-on. I think I am almost there.  i got it to work or all attributes, but not showing blue circle. just showing blue and circle independently. 


  8. 2 hours ago, Papanco said:

    Greetings to all: I tried to install it on CE-Phoenix-1.0.7.1 on php 7.3 with MySQL 5.6.47 but the new administrator's menu does not appear: can someone help me?
    Thanks.

    DROP TABLE IF EXISTS  `administrator_group_access` ;
    CREATE TABLE `administrator_group_access` (
      `administrator_group_access_id` int(11) NOT NULL,
      `administrator_group_id` int(11) NOT NULL,
      `administrator_group_block` varchar(1000) CHARACTER SET utf8 NOT NULL,
      `administrator_group_access_file` varchar(50) CHARACTER SET utf8 NOT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
    ALTER TABLE `administrator_group_access`
      ADD PRIMARY KEY (`administrator_group_access_id`);
    ALTER TABLE `administrator_group_access`
      MODIFY `administrator_group_access_id` int(11) NOT NULL AUTO_INCREMENT;

    run this in your phpmyadmin


  9. 1 hour ago, LeeFoster said:

    Yes it does need there to be an image for all options.

    so lets say you have two attributes

    color  red/greenn/blue

    shape.  circle/square

    so do we want to show blue when blue is selected

    and when they choose circle then blue is replaced with circle

    it would be better to show a blue circle

    but this makes the whole thing more complicated.


  10. 1 hour ago, LeeFoster said:

    Couldn't get it to work as a hook, rather than wait for someone else to come up with a solution I decided to take a different approach and create it as a header tag module and now I have a working image change function. 

    And then I realise the reason the hook isn't working is because notepad++ isn't saving the file as .php and I have it working as a hook.

    I prefer the header tag. removing a hook file is dangerous


  11. <script>
    $(function() {
        var img_option='images/sample/'+'lime-1'+'.jpg';
        $("#input_1").change(function(){
            val = $("#input_1 option:selected").text();
            $("a.lb:first").html( "<img src="+ img_option+">");
          $('a.lb:first img').css({'width' : '150px' , 'height' : '150px'});
            $('a.lb:first img').addClass( "img-fluid" );
        });
    });
    </script>

    you can add the class also


  12. 5 minutes ago, burt said:

    Nice to see you guys having a go, rather than just talking and more talking 👍

    When you get it to a "happy" conclusion, I'll post what I coded yesterday (PROTO code, not really tested etc).

    that is where the difference between a real coder and copy and paster like me😡

×