0

Recap:

My javascript

$j(textoDelId, window.parent.document).html('Add<input type="hidden" id="imagenv" name="imagenv" value="'+imgstr+'"/>');     

My new submit button:

<form action="javascript:void(0);" name="imagen" id="imagen" method="post"><button id="<?php echo $idBotonCarritoCustom ?>" type="submit" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="mandarAlCarro('<?php echo $this->getAddToCartUrl($_product) ?>',
                        <?php $idOptionCorte = -1; foreach ($_product->getProductOptionsCollection() as $option) {
                        if($option->getTitle() == 'Corte') {
                            $idOptionCorte = $option->getOptionId();
                        }}
                            echo $idOptionCorte?>, <?php echo $_product->_getData('entity_id'); ?>)">
                        <span><span><?php echo $this->__('Add to Cart') ?></span></span></button></form>

And finally the final destination:

<?php echo $_POST["imagenv"]; ?>

imgstr has the correct value as a alert after that JS line, shows that string that I want to pass.

Edited by riahc3

0

After executing the Javascript the page ends up something like this (this is the PHTML page, where the submit button is but this is the pure HTML output)

<form id="imagen" method="post" name="imagen" action="javascript:void(0);">
<button id="botonCarrito2" class="button btn-cart" onclick="mandarAlCarro('http://host.dev/store/checkout/cart/add/uenc/aHR0cDovL21ldHJvbmljcy5kZXYvcGFzdGVsZXJpYXRvbG9zYW5hL3Bhc3RlbGVzLWRlLWNvcnRlLmh0bWw,/product/2/', 2, 2)" title="Add" type="submit">
<span>
<span>
Add
<input id="imagenv" type="hidden" value="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAACDklEQVR4nO3cMWsUQQCG4S8xarxCQW1CSCG2QlAEEYUrbIPpjGCwiZ12oo2Ke4eFjYWIIogSUELEfyBCSn/WWnhkvRhCLjc738zO+/Q383LL3u3u3YwEAAAAAAAAAAAAAAAAlG2ovobquzNKdlzSQNK2pIEq1apUS/ol6Z61rBC3JN054mu/SZoL2FKsnhT0Y6gn6UnA8YpxUdKJlue43fL4nXEl4lyLo++enYhzZuORZdZKtZ7pt2XuhG24AyR9cgek4qw74B8P3QFuJ90B+3jgDnA57Q44wHt3QDyVdrShn+6MQ3jsDogjr8vMY+6Atp1yB0wot96JzboDjuCDO6Atz90B6I5X7oDQ7rsD0D2FXAbnY8YdEMpTdwC666Y7YFqdOc1H3rkDprXmDgjshjtgWm/cAUE1fzVCEjggybnuDsC4t+4AjLvqDgCSdcEdgHGX3AFodOan3C/ugECW3AGhXHMHBLDuDkDHrbgDpnDOHRBevs9/XrgD2pHnAWFpQkI+uwPQeOkOiO28O+AAW+4ANDbdASlYcAeMXHYHpOSHce4c/4kfxaziny2rkefLUqydFbjHmNAg+IjNzWkv+NgF+a7XOhNkD6w8nxYkaKh+gDcy5t4pxZjX3w3LJlG10IE9DrOg/64KWM6cmo+1VNfaXe++LOmrM6h4ew4IAAAAAAAAAAAAAAAAAAD/+QPHG0cjw8oB2AAAAABJRU5ErkJggg==" name="imagenv">
</span>
</span>
</button>
</form>

As you see when I click the button, it is inside the form and should transfer that hiddent imagenv right?

0

Hi riah, I am not sure what mandarAlCarro function is doing.. If it is submitting form imagenv then you must get imagenv value. Can you debug by this code so you can know how many variables are passed to next page.

echo '<pre>';
print_r($_POST);
print_r($_GET);
exit;
0

Ive been all day with this so sorry for not reading :)

Ive FINALLY gotten the value pass over. The value being:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAACCElEQVR4nO3aPWsVQRiG4ScmJpGACmowginEDxDUQhsh6VJErIMgiE3aFBbamOIIYiEiCiKCCiKGiOmD/25TrLD5ICbszuwzM3tfdc68N xZNntmJAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA5h5K iBpUdJtSUuStq1FAzMmaeuYfzuK2DF4y5IutvjcjdAhQ/e88wojVRqpCtAyaF CrcQF6eRBpHVPRlq3WKcknY24/q IaxfnRQ8z7vUwI3vfe5w10 Os7ExLGndHoPbDHYDarDsAjXfuANTOuQN2Oe0OcPvpDtjnjjvAZVJpvhU/cwc4bLgD/iO1Oza6m 6AI5xwB/Rl0R2Axid3ABopPrgP88gdENNLd0ALT90BsSy4A1C75A7oYMwdENofd0BHr90BIeV8ZxQl9Ze8Qdl0BwR03BOOybrgDggswwd6uYfIrrsD2in3gsy7A7q45g7AQevugICW3QGhvHUHBDDhDggt92/XfXdADGfcAS2ddwdgr0l3ABpf3QF9yPBNt3w5nFIv7j ro6R8p6y5A5xSe2j dgek4K474J9Vd0BKvpnnPzbPT9JV09zPprnZeNXjrI89zsralKRbkWdMR16/TJVUVQqw4dVsnL3vXjVguy7IitpvfF0ueCczGeuS3qj efyK6gMVc6qPHD2R9Fd5HeAGAAAAAADAXjv0OTZdFaBJ7wAAAABJRU5ErkJggg==

But, I cant get it to display. So now it does the GET correctly (passing it to the other page) but it doesnt display it.

This is in FF BTW...

Edited by riahc3

0

mandarAlCarro

Basically this goes to the other page. Technically it creates the url to go to the other page. Then (if setLocation is right) it goes to that page.

Ive just put the values in there using standard GET writing. And it DOES pass the values :) now displaying them is another issue.

Ive tried echoing it; Nothing
Ive tried <img src="(echoing)"></img> still nothing....

So frustrating when you feel you are so close yet so far.

0

More digging.....

Using this code here:

                    <script type="text/javascript">

                    function getUrlVars() {
                        var vars = {};
                        var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function
                        (m,key,value) {
                        vars[key] = value;
                        });
                            return vars;
                            }

                    var first = getUrlVars()["imagenv"];
                    alert(first);

                </script>

I am able to see the values of the variables I pass thru GET and POST. When it pops up I get "undefined"

That doesnt make any sense because using Firebug I see that thru GET imagenv IS indeed getting passed with values so......

Man, Im happy its Friday and wont have to tackle this till Monday. But for now still 45 mins to go....

0

print_r($_GET);

I also did as you said a

<?php print_r($_GET);?>

And (to my surprise) it printed

Array ( )

With problably means Firebug is lying to me......

Thanks for all the help :)

0

OK

On the second page (where the image is suppose to be displayed and it is a PHTML page) I have:

<script type="text/javascript">
                    function dibujofun()
                    {
                    var dibujo = localStorage.getItem('foto');
                    alert("soy dibujo fun" + dibujo);
                    return dibujo;
                    }

                    </script>

<script type="text/javascript">dibujofun();</script>

and it works (it returns the string with the data)

but

<img src=<script type="text/javascript">dibujofun();</script></img>

Doesnt. Why not?

This is driving me crazy....

0

Hi,

I know it is kind of silly to ask, you probably know it. What do you see if you do this??

        $out = base64_decode('iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAACA0lEQVR4nO3cwUsUYRzG8UdhKa0oEREpCjoUSOlJgiAWIbp26FZQt+iS2CH0ImwGXj2IWiePhnSo6L5/2nQoqFmVRvd93+edfb+f8/B7vzDsLDvzzkoAAAAAAAAAAAAAAAAAAPxrU11tquvOwG8P1VOlnipJHyR9dAeV6rDBMfvRKyBJmjzj8QdRKjC0BXfAqOkEmLERYAYkvQ0466KksYDzinMn0tzxSHMxhNvugLbZSbBGrE8ghjDnDmiDp+4AAANm3QG5emNc+7NxbZzinjsgJ4vuANS9cAf88dwdgONuuQPcrrkDBhR/E3LFHXCCLXcAICnvy4Pzd5FNjperos27A/7jujsAdQ/cASjYd3dAQ8vugFTuugMaeuUOQIFCbIBL4+/G7pH2zh3QWCEn5LE74Ix23QGo++QOQN2qOyCml+6Ac3jtDoijvV+Q6+6AONp7Qr64A2KacgecQ8h3VbJzwR0AAKNrzx2Aupw3YhSn+F2MubnpDkhhwh3Q0CV3QCpt2VpzxR2QypI7oIFtd0BKI30ru41+uANQl/O1Obd3VYp2wx2AnvrqqS/pqjvF7Zs7QFKbH5gFl8P/Vh25A3LzyLRuRzwky8aaOyBrlVRVSnIN/5pgjfaLfEI6kp5Eml2EZwFmTIs7AcG9lzTT8NjLkn5Kuh8vBwAAAAAAAACAJn4Bse83Wq3XeMoAAAAASUVORK5CYII');

        echo $out;

That should give you something on the screen... I think :)

UPDATED LATER:

The above should give you something like this

<div id="page" class="shell">
<!-- Logo + Search + Navigation -->
<div id="top">
<div class="cl">&nbsp;</div>
<h1 id="logo"><a href="SITE_URL/lib/skins/lolim/images/logo.gif">MONDAYS</a></h1>
<div class="field-holder">
<br />

Edited by veedeoo: more info added

0

Hi, I know it is kind of silly to ask, you probably know it. What do you see if you do this?? $out = base64_decode('iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAACA0lEQVR4nO3cwUsUYRzG8UdhKa0oEREpCjoUSOlJgiAWIbp26FZQt+iS2CH0ImwGXj2IWiePhnSo6L5/2nQoqFmVRvd93+edfb+f8/B7vzDsLDvzzkoAAAAAAAAAAAAAAAAAAPxrU11tquvOwG8P1VOlnipJHyR9dAeV6rDBMfvRKyBJmjzj8QdRKjC0BXfAqOkEmLERYAYkvQ0466KksYDzinMn0tzxSHMxhNvugLbZSbBGrE8ghjDnDmiDp+4AAANm3QG5emNc+7NxbZzinjsgJ4vuANS9cAf88dwdgONuuQPcrrkDBhR/E3LFHXCCLXcAICnvy4Pzd5FNjperos27A/7jujsAdQ/cASjYd3dAQ8vugFTuugMaeuUOQIFCbIBL4+/G7pH2zh3QWCEn5LE74Ix23QGo++QOQN2qOyCml+6Ac3jtDoijvV+Q6+6AONp7Qr64A2KacgecQ8h3VbJzwR0AAKNrzx2Aupw3YhSn+F2MubnpDkhhwh3Q0CV3QCpt2VpzxR2QypI7oIFtd0BKI30ru41+uANQl/O1Obd3VYp2wx2AnvrqqS/pqjvF7Zs7QFKbH5gFl8P/Vh25A3LzyLRuRzwky8aaOyBrlVRVSnIN/5pgjfaLfEI6kp5Eml2EZwFmTIs7AcG9lzTT8NjLkn5Kuh8vBwAAAAAAAACAJn4Bse83Wq3XeMoAAAAASUVORK5CYII'); echo $out; That should give you something on the screen... I think :) UPDATED LATER: The above should give you something like this <div id="page" class="shell"><!-- Logo + Search + Navigation --><div id="top"><div class="cl">&nbsp;</div><h1 id="logo"><a href="SITE_URL/lib/skins/lolim/images/logo.gif">MONDAYS</a></h1><div class="field-holder"><br />

Go ahead and assume I know nothing :P

The $out variable is PHP AFAIK.. So it would be

<?php echo base64_decode($_POST['imagenv']); ?

If Im passing it thru post/get....

0

Still nothing.

The strange part is when I printed out:

<?php print_r($_GET);?>

It shows nothing (Array ())

That being said, I do pass another parameter (options) and this does get passed because at the end of the entire process, I call a web service that uses these parameters correctly. So I can confirm 100% that my variable imagenv GETS PASSED without a doubt. I just cannot display it for some odd reason. It makes no sense at all.

0

Your magento url is:
../product/2/?imagenv=data:image..

Try with:
../product/2/imagenv/data:image..

0

Your magento url is:
../product/2/?imagenv=data:image..

Try with:
../product/2/imagenv/data:image..

Strange.....but Ill try to make that URL.....

0

Strange.....but Ill try to make that URL.....

Nothing. Still same thing.

Local storage is the closest I have gotten to making the transfer thru so.....I think I should conitnue with the local storage idea.

0

Hi,

Run this script on your local server..

<?php
function showMe($thisY){
        $out = "";
        $out .=header('Content-type: image/png');
        $out .= base64_decode($thisY);

        return $out;
    }
if (isset($_GET['submit'])){
 $thisX = $_GET['imagenv'];
    echo showMe($thisX);


}
else{
 $someX = "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAACA0lEQVR4nO3cwUsUYRzG8UdhKa0oEREpCjoUSOlJgiAWIbp26FZQt+iS2CH0ImwGXj2IWiePhnSo6L5/2nQoqFmVRvd93+edfb+f8/B7vzDsLDvzzkoAAAAAAAAAAAAAAAAAAPxrU11tquvOwG8P1VOlnipJHyR9dAeV6rDBMfvRKyBJmjzj8QdRKjC0BXfAqOkEmLERYAYkvQ0466KksYDzinMn0tzxSHMxhNvugLbZSbBGrE8ghjDnDmiDp+4AAANm3QG5emNc+7NxbZzinjsgJ4vuANS9cAf88dwdgONuuQPcrrkDBhR/E3LFHXCCLXcAICnvy4Pzd5FNjperos27A/7jujsAdQ/cASjYd3dAQ8vugFTuugMaeuUOQIFCbIBL4+/G7pH2zh3QWCEn5LE74Ix23QGo++QOQN2qOyCml+6Ac3jtDoijvV+Q6+6AONp7Qr64A2KacgecQ8h3VbJzwR0AAKNrzx2Aupw3YhSn+F2MubnpDkhhwh3Q0CV3QCpt2VpzxR2QypI7oIFtd0BKI30ru41+uANQl/O1Obd3VYp2wx2AnvrqqS/pqjvF7Zs7QFKbH5gFl8P/Vh25A3LzyLRuRzwky8aaOyBrlVRVSnIN/5pgjfaLfEI6kp5Eml2EZwFmTIs7AcG9lzTT8NjLkn5Kuh8vBwAAAAAAAACAJn4Bse83Wq3XeMoAAAAASUVORK5CYII=";
?>
<form id="imagen" method="get" name="imagen" action="#">
    Con Corte - Añadir carro
    <input id="imagenv" name="imagenv" type="hidden" value="<?=$someX?>"/>
    <input type="submit" name="submit" value="submit"/>
    </form>

    <?php
    }

?>

That should show you an image...as output. I removed this part of your code from the hidden input

  data:image/png;base64,

please ignore the expected result I posted on my first PoST, that was from other script I am currently testing.

Edited by veedeoo: more info added

0

Ill try that tommorow as Im about to head off work. This has been killing me all day!

I want to thank everyone that is helping and trying to give suggestions :)

Ill try this tommorow ASAP.

0

OK I ran it (and although obvious Ill describe everything that happens)

A text appeasrs saying "Con Corte - Añadir carro" with a button at its right saying "submit". I click the button and the page seems to load (or refresh) and then the page appears with the drawing/picture.

Thats all that happens. (which from the code appear to be correct.)

Edited by riahc3

0

Not sure where to continue on from here although at least it shows on "another" (between quotes obviously) page...

0

After that PHP page showing what it showed, what do I do from there? It obviously passes the data and shows it but of course, I have to do it on my site.

0

Is there a possibility to do this with AJAX (although rethinking it may be reverse AJAX)? It may not be the best choice (nor do I even know how to use it but it comes to mind.

Edited by riahc3

0

I tried sending it to a plain PHP with this:

<?php
$foto=$_REQUEST["foto"];
echo "<html><head><title></title></head><body>Wait: <div id='foto'><img src='".$foto."'></img></div></body></html>";
?>

It shows wait and it shows a white 100 x 100 block (my picture is 100 x 100) but it does not show the image.

0

1 week later..............FINALLY :)

That local storage page you gave me diafol did the trick :) It FINALLY got the image thru and displays it.

I cannot thank you enough :) This thread has been going a week plus and it was killing me. The stress was getting unsupportable (one of the reasons that I couldnt even sleep all night correctly)

Thanks a lot :) Its not over as I have to do this for each product I add to the cart but I think this will be easier (I hope) again, thanks diafol.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.