Показать сообщение отдельно
  #19 (permalink)  
Старый 04.08.2015, 18:42
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

ligisayan,
зачем это делать мне непонятно - есть же css на странице меняйте там стили и сервер меняйте там классы.

или уж создайте элемент на странице и украшивайте как хотите.
<!DOCTYPE HTML>

<html>

<head>
  <title>Untitled</title> <meta charset="utf-8">
</head>

<body>
<script>
  var variations_form =   [{
    "variation_id": 3354,
    "variation_is_visible": true,
    "variation_is_active": true,
    "is_purchasable": true,
    "display_price": 260000,
    "display_regular_price": 260000,
    "attributes": {
        "attribute_pa_size": "large"
    },
    "image_src": "",
    "image_link": "",
    "image_title": "",
    "image_alt": "",
    "price_html": "<span class=\"price\"><span class=\"amount\">260.000 руб.<\/span><\/span>",
    "availability_html": "",
    "sku": "",
    "weight": " kg",
    "dimensions": "",
    "min_qty": 1,
    "max_qty": "",
    "backorders_allowed": false,
    "is_in_stock": true,
    "is_downloadable": false,
    "is_virtual": false,
    "is_sold_individually": "no"
}, {
    "variation_id": 3355,
    "variation_is_visible": true,
    "variation_is_active": true,
    "is_purchasable": true,
    "display_price": 160000,
    "display_regular_price": 160000,
    "attributes": {
        "attribute_pa_size": "medium"
    },
    "image_src": "",
    "image_link": "",
    "image_title": "",
    "image_alt": "",
    "price_html": "<span class=\"price\"><span class=\"amount\">160.000 руб.<\/span><\/span>",
    "availability_html": "",
    "sku": "",
    "weight": " kg",
    "dimensions": "",
    "min_qty": 1,
    "max_qty": "",
    "backorders_allowed": false,
    "is_in_stock": true,
    "is_downloadable": false,
    "is_virtual": false,
    "is_sold_individually": "no"
}, {
    "variation_id": 3356,
    "variation_is_visible": true,
    "variation_is_active": true,
    "is_purchasable": true,
    "display_price": 80000,
    "display_regular_price": 80000,
    "attributes": {
        "attribute_pa_size": "small"
    },
    "image_src": "",
    "image_link": "",
    "image_title": "",
    "image_alt": "",
    "price_html": "<span class=\"price\"><span class=\"amount\">80.000 руб.<\/span><\/span>",
    "availability_html": "",
    "sku": "",
    "weight": " kg",
    "dimensions": "",
    "min_qty": 1,
    "max_qty": "",
    "backorders_allowed": false,
    "is_in_stock": true,
    "is_downloadable": false,
    "is_virtual": false,
    "is_sold_individually": "no"
}]

</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <script>
     $(function(){
       var s = variations_form[2]['price_html'], height = 100;
      s = $('<div/>', {html : s});
      s.find('.price').addClass("new").css({"top": (height+32)+"px"});
      variations_form[2]['price_html'] =  s.html()
      alert(variations_form[2]['price_html'])
});
 </script>


</body>

</html>

Последний раз редактировалось рони, 04.08.2015 в 18:44.
Ответить с цитированием